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 11#! /bin/bash
22set  -euo pipefail
33
4+ TEMP_FILE=$( mktemp) 
5+ echo  " Using temporary file: ${TEMP_FILE} " 
6+ trap  ' rm -f "${TEMP_FILE}"'   EXIT
7+ 
48MAX_ATTEMPTS=3
59for  attempt  in  $( seq 1 " ${MAX_ATTEMPTS} " ) ;  do 
610    echo  " Attempt ${attempt}  to authenticate with Vault..." 
711
8-     RESPONSE=$( curl -sS -w " %{http_code}"   -o response.json  \
12+     RESPONSE=$( curl -sS -w " %{http_code}"   -o " ${TEMP_FILE} "   \
913        -X POST " ${VAULT_URL} /v1/auth/github-actions-oidc/login"   \ 
1014        -H " Content-Type: application/json"   \ 
1115        -H " Proxy-Authorization-Token: Bearer ${GITHUB_JWT_PROXY} "   \ 
@@ -15,14 +19,14 @@ for attempt in $(seq 1 "${MAX_ATTEMPTS}"); do
1519        }"   ||  true) 
1620
1721    if  [[ " ${RESPONSE} "   -eq  200 ]];  then 
18-         TOKEN=$( jq -r ' .auth.client_token'   response.json ) 
22+         TOKEN=$( jq -r ' .auth.client_token'   " ${TEMP_FILE} " ) 
1923        echo  " ::add-mask::$TOKEN " 
2024        echo  " vault_token=${TOKEN} "   >>  " ${GITHUB_OUTPUT} " 
2125        echo  " Vault auth done!" 
2226        exit  0
2327    else 
2428        echo  " Vault auth failed (HTTP ${RESPONSE} )" 
25-         cat response.json  ||  true 
29+         cat " ${TEMP_FILE} "   ||  true 
2630        sleep $(( attempt *  5 )) 
2731    fi 
2832done 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments