Skip to content

Commit c8f29f8

Browse files
updating logic for token
1 parent 1cb81c1 commit c8f29f8

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/scripts/ppc64le/self-hosted-builder/[email protected]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ StartLimitIntervalSec=0
77
Type=simple
88
Restart=always
99
ExecStartPre=-/usr/bin/docker rm --force actions-runner.%i
10-
ExecStartPre=-/usr/local/bin/app_token.sh /etc/actions-runner/%i/appid.env /etc/actions-runner/%i/key_private.pem /etc/actions-runner/%i/ghtoken.env
10+
ExecStartPre=-/usr/local/bin/gh_token_generator.sh /etc/actions-runner/%i/appid.env /etc/actions-runner/%i/installid.env /etc/actions-runner/%i/key_private.pem /etc/actions-runner/%i/ghtoken.env
1111
ExecStart=/usr/bin/docker run \
1212
--env-file=/etc/actions-runner/%i/env \
1313
--env-file=/etc/actions-runner/%i/ghtoken.env \

.github/scripts/ppc64le/self-hosted-builder/helpers/app_token.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,19 @@ signature=$(echo -n "${header_base64}.${payload_base64}" | \
2525
openssl dgst -sha256 -sign "$PRIVATE_KEY_PATH" | \
2626
openssl base64 | tr -d '=' | tr '/+' '_-' | tr -d '\n')
2727

28-
jwt="${header_base64}.${payload_base64}.${signature}"
29-
echo "ACCESS_TOKEN=${jwt}" > "${DST_FILE}"
28+
generated_jwt="${header_base64}.${payload_base64}.${signature}"
29+
30+
API_VERSION=v3
31+
API_HEADER="Accept: application/vnd.github+json"
32+
33+
auth_header="Authorization: Bearer ${generated_jwt}"
34+
35+
app_installations_response=$(curl -sX POST \
36+
-H "${auth_header}" \
37+
-H "${API_HEADER}" \
38+
--url "https://api.github.com/app/installations/${INSTALL_ID}/access_tokens" \
39+
)
40+
41+
echo "$app_installations_response" | jq --raw-output '.token'
42+
43+
#echo "ACCESS_TOKEN=${jwt}" > "${DST_FILE}"

0 commit comments

Comments
 (0)