Skip to content

Commit 6f9637a

Browse files
committed
👀
1 parent ef6752e commit 6f9637a

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

.github/workflows/pull-requests-built-files.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,16 @@ jobs:
5252
5353
APP_ID=${{ env.GH_APP_ID }}
5454
55-
# Generate JWT
56-
JWT=$(python3 - <<EOF
57-
import jwt, time
58-
private_key = open("private-key.pem", "r").read()
59-
payload = {
60-
"iat": int(time.time()),
61-
"exp": int(time.time()) + 600, # 10-minute expiration
62-
"iss": $APP_ID
63-
}
64-
print(jwt.encode(payload, private_key, algorithm="RS256"))
65-
EOF
66-
)
6755
56+
# Get Installation ID
57+
INSTALLATION_ID=$(curl -s -X GET -H "Authorization: Bearer $JWT" \
58+
-H "Accept: application/vnd.github.v3+json" \
59+
https://api.github.com/app/installations | jq -r '.[0].id')
6860
61+
# Request Installation Access Token
62+
ACCESS_TOKEN=$(curl -s -X POST -H "Authorization: Bearer $JWT" \
63+
-H "Accept: application/vnd.github.v3+json" \
64+
https://api.github.com/app/installations/$INSTALLATION_ID/access_tokens | jq -r '.token')
6965
7066
echo "ACCESS_TOKEN=$ACCESS_TOKEN" >> "$GITHUB_ENV"
7167

0 commit comments

Comments
 (0)