Skip to content

Commit 3166d1f

Browse files
committed
fix: shellcheck og formatering
1 parent cf9b83e commit 3166d1f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

get-installation-access-token.sh

+11-11
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ export PRIVATE_KEY=${1:?Usage: ${0} <private-key> <app-id>}
33
export APP_ID=${2:?Usage: ${0} <private-key> <app-id>}
44
repo=${GITHUB_REPOSITORY:?Missing required GITHUB_REPOSITORY environment variable}
55

6-
[[ ! -z "$INPUT_REPO" ]] && repo=$INPUT_REPO
6+
[ -n "$INPUT_REPO" ] && repo="$INPUT_REPO"
77

8-
jwt=$(ruby $(dirname $0)/generate_jwt.rb)
9-
response=$(curl -s -H "Authorization: Bearer ${jwt}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${repo}/installation)
10-
installation_id=$(echo $response | jq -r .id)
8+
jwt=$(ruby "$(dirname "$0")"/generate_jwt.rb)
9+
response=$(curl -s -H "Authorization: Bearer ${jwt}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/${repo}/installation")
10+
installation_id=$(echo "$response" | jq -r .id)
1111

1212
if [ "$installation_id" = "null" ]; then
1313
echo "Unable to get installation ID. Is the GitHub App installed on ${repo}?"
14-
echo $(echo $response | jq -r .message)
14+
echo "$response" | jq -r .message
1515
exit 1
1616
fi
1717

1818
token=$(curl -s -X POST \
19-
-H "Authorization: Bearer ${jwt}" \
20-
-H "Accept: application/vnd.github.v3+json" \
21-
https://api.github.com/app/installations/${installation_id}/access_tokens | jq -r .token)
19+
-H "Authorization: Bearer ${jwt}" \
20+
-H "Accept: application/vnd.github.v3+json" \
21+
https://api.github.com/app/installations/"${installation_id}"/access_tokens | jq -r .token)
2222

2323
if [ "$token" = "null" ]; then
24-
echo "Unable to generate installation access token"
25-
exit 1
24+
echo "Unable to generate installation access token"
25+
exit 1
2626
fi
2727

28-
echo ::set-output name=token::${token}
28+
echo "::set-output name=token::${token}"

0 commit comments

Comments
 (0)