Skip to content

Commit 7803c2c

Browse files
authored
fix(login-to-gar): check if delete_credentials_file is set (#1020)
* Check if delete_credentials_file is set After #1009, there was a condition which checked for credentials path and the actual input flag which was accidentally removed. This PR adds it back * Fix zizmor
1 parent 0789629 commit 7803c2c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

actions/login-to-gar/action.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ runs:
7878
- name: Delete Google Application Credentials file
7979
shell: sh
8080
run: |
81-
if [ -f "${{ env.GOOGLE_APPLICATION_CREDENTIALS }}" ]; then
82-
rm -f "${{ env.GOOGLE_APPLICATION_CREDENTIALS }}"
81+
if [ "${INPUTS_DELETE_CREDENTIALS_FILE}" = "true" ] && [ -n "${GOOGLE_APPLICATION_CREDENTIALS}" ]; then
82+
rm -f "${GOOGLE_APPLICATION_CREDENTIALS}"
8383
echo "::notice::Successfully deleted credentials file"
8484
else
85-
echo "::warning::Credentials file not found at ${{ env.GOOGLE_APPLICATION_CREDENTIALS }}"
85+
echo "::warning::Credentials file not found at ${GOOGLE_APPLICATION_CREDENTIALS}"
8686
fi
87+
env:
88+
INPUTS_DELETE_CREDENTIALS_FILE: ${{ inputs.delete_credentials_file }}
89+
GOOGLE_APPLICATION_CREDENTIALS: ${{ env.GOOGLE_APPLICATION_CREDENTIALS }}

0 commit comments

Comments
 (0)