File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6363 project_id : ${{ env.GCP_PROJECT_ID }}
6464 version : " >= 416.0.0"
6565
66- - name : Invoke service
66+ - name : Resolve service URL
67+ id : service
6768 run : |
6869 set -euo pipefail
6970
8586 exit 1
8687 fi
8788
88- token="$(gcloud auth print-identity-token --audiences="${service_url}")"
89+ echo "url=${service_url}" >> "$GITHUB_OUTPUT"
90+ echo "path=${raw_path}" >> "$GITHUB_OUTPUT"
91+
92+ - name : Authenticate for service invocation
93+ id : invoke-auth
94+ uses : google-github-actions/auth@v3
95+ with :
96+ workload_identity_provider : ${{ env.GCP_WORKLOAD_IDENTITY_PROVIDER }}
97+ service_account : ${{ env.GCP_WORKLOAD_IDENTITY_SERVICE_ACCOUNT }}
98+ token_format : id_token
99+ id_token_audience : ${{ steps.service.outputs.url }}
100+ id_token_include_email : true
101+
102+ - name : Invoke service
103+ run : |
104+ set -euo pipefail
105+
89106 curl --fail-with-body --show-error --silent \
90107 --request POST \
91- --header "Authorization: Bearer ${token }" \
92- "${service_url}${raw_path }"
108+ --header "Authorization: Bearer ${{ steps.invoke-auth.outputs.id_token } }" \
109+ "${{ steps.service.outputs.url }}${{ steps.service.outputs.path } }"
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ grep -Fq "CLOUD_RUN_REGION: \${{ vars.CLOUD_RUN_REGION }}" "$workflow_file"
1414grep -Fq " CLOUD_RUN_SERVICE: \$ {{ vars.CLOUD_RUN_SERVICE }}" " $workflow_file "
1515grep -Fq " longbridge-hk|longbridge-sg" " $workflow_file "
1616grep -Fq " gcloud run services describe \"\$ {CLOUD_RUN_SERVICE}\" " " $workflow_file "
17- grep -Fq " gcloud auth print-identity-token --audiences=\"\$ {service_url}\" " " $workflow_file "
17+ grep -Fq " token_format: id_token" " $workflow_file "
18+ grep -Fq " id_token_audience: \$ {{ steps.service.outputs.url }}" " $workflow_file "
19+ grep -Fq " id_token_include_email: true" " $workflow_file "
1820grep -Fq " curl --fail-with-body --show-error --silent" " $workflow_file "
1921grep -Fq -- " --request POST" " $workflow_file "
22+ grep -Fq " steps.invoke-auth.outputs.id_token" " $workflow_file "
You can’t perform that action at this time.
0 commit comments