Skip to content

Commit

Permalink
Update get_gh_token.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
AgnesToulet committed Oct 10, 2024
1 parent a31b70b commit b051990
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/get_gh_token.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ set -e

# Ensure necessary tools are installed
apk add --no-cache openssl curl jq
echo "tools installed"

# Write the private key to a file
echo "$GITHUB_APP_PRIVATE_KEY" > private-key.pem
chmod 600 private-key.pem

echo "private key in file"

# Generate the JWT
NOW=$(date +%s)
EXPIRATION=$(($NOW + 600))
Expand All @@ -24,6 +27,8 @@ RESPONSE=$(curl -s -X POST \
-H "Accept: application/vnd.github+json" \
https://api.github.com/app/installations/$GITHUB_INSTALLATION_ID/access_tokens)

echo "get access token"

# Extract the token from the response
GITHUB_TOKEN=$(echo $RESPONSE | jq -r '.token')

Expand Down

0 comments on commit b051990

Please sign in to comment.