@@ -3,27 +3,26 @@ export PRIVATE_KEY=${1:?Usage: ${0} <private-key> <app-id>}
3
3
export APP_ID=${2:? Usage: ${0} <private-key> <app-id>}
4
4
repo=${GITHUB_REPOSITORY:? Missing required GITHUB_REPOSITORY environment variable}
5
5
6
- [[ ! -z " $INPUT_REPO " ]] && repo=$INPUT_REPO
6
+ [ -n " $INPUT_REPO " ] && repo=" $INPUT_REPO "
7
7
8
- jwt=$( ruby $( dirname $0 ) /generate-jwt.rb)
9
- installation_id=$( curl -s \
10
- -H " Authorization: Bearer ${jwt} " \
11
- -H " Accept: application/vnd.github.v3+json" \
12
- https://api.github.com/repos/${repo} /installation | 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)
13
11
14
12
if [ " $installation_id " = " null" ]; then
15
- echo " Unable to get installation ID. Is the GitHub App installed on ${repo} ?"
16
- exit 1
13
+ echo " Unable to get installation ID. Is the GitHub App installed on ${repo} ?"
14
+ echo " $response " | jq -r .message
15
+ exit 1
17
16
fi
18
17
19
18
token=$( curl -s -X POST \
20
- -H " Authorization: Bearer ${jwt} " \
21
- -H " Accept: application/vnd.github.v3+json" \
22
- 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)
23
22
24
23
if [ " $token " = " null" ]; then
25
- echo " Unable to generate installation access token"
26
- exit 1
24
+ echo " Unable to generate installation access token"
25
+ exit 1
27
26
fi
28
27
29
- echo ::set-output name=token::${token}
28
+ echo " ::set-output name=token::${token} "
0 commit comments