File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,19 @@ trap_with_arg() {
2222deregister_runner () {
2323 echo " Caught $1 - Deregistering runner"
2424 if [[ -n " ${ACCESS_TOKEN} " ]]; then
25+ # If using GitHub App authentication, refresh the access token before deregistration
26+ if [[ -n " ${APP_ID} " ]] && [[ -n " ${APP_PRIVATE_KEY} " ]] && [[ -n " ${APP_LOGIN} " ]]; then
27+ echo " Refreshing access token for deregistration"
28+ nl="
29+ "
30+ NEW_ACCESS_TOKEN=$( APP_ID=" ${APP_ID} " APP_PRIVATE_KEY=" ${APP_PRIVATE_KEY// \\ n/ ${nl} } " APP_LOGIN=" ${APP_LOGIN} " bash /app_token.sh)
31+ if [[ -z " ${NEW_ACCESS_TOKEN} " ]] || [[ " ${NEW_ACCESS_TOKEN} " == " null" ]]; then
32+ echo " ERROR: Failed to refresh access token for deregistration"
33+ exit 1
34+ fi
35+ ACCESS_TOKEN=" ${NEW_ACCESS_TOKEN} "
36+ echo " Access token refreshed successfully"
37+ fi
2538 _TOKEN=$( ACCESS_TOKEN=" ${ACCESS_TOKEN} " bash /token.sh)
2639 RUNNER_TOKEN=$( echo " ${_TOKEN} " | jq -r .token)
2740 fi
You can’t perform that action at this time.
0 commit comments