File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
actions/create-github-app-token Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -8,22 +8,26 @@ setRandomApp() {
88 echo " Randomly selected GitHub App: ${GITHUB_APP} "
99}
1010
11+ TEMP_FILE=$( mktemp)
12+ echo " Using temporary file: ${TEMP_FILE} "
13+ trap ' rm -f "${TEMP_FILE}"' EXIT
14+
1115for attempt in $( seq 1 " ${MAX_ATTEMPTS} " ) ; do
1216 echo " Attempt ${attempt} to get GitHub token..."
1317 setRandomApp
14- RESPONSE=$( curl -sS -w " %{http_code}" -o response.json \
18+ RESPONSE=$( curl -sS -w " %{http_code}" -o " ${TEMP_FILE} " \
1519 " ${VAULT_URL} /v1/github-app-${GITHUB_APP} /token/${REPOSITORY_NAME} -${REF_SHA} -${PERMISSION_SET} " \
1620 -H " X-Vault-Token: ${VAULT_TOKEN} " \
1721 -H " Proxy-Authorization-Token: Bearer ${GITHUB_JWT_PROXY} " || true)
1822
1923 if [[ " ${RESPONSE} " -eq 200 ]]; then
20- TOKEN=$( jq -r ' .data.token' response.json )
24+ TOKEN=$( jq -r ' .data.token' " ${TEMP_FILE} " )
2125 echo " github_token=${TOKEN} " >> " ${GITHUB_OUTPUT} "
2226 echo " Create GitHub Token done!"
2327 exit 0
2428 else
2529 echo " Vault request failed (HTTP ${RESPONSE} )"
26- cat response.json || true
30+ cat " ${TEMP_FILE} " || true
2731 sleep $(( attempt * 5 ))
2832 fi
2933done
You can’t perform that action at this time.
0 commit comments