3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-02-19 15:23:42 +00:00

[Security]: Prevent persisting the remote when there are errors (#232)

This commit is contained in:
Tonye Jack 2021-10-27 07:30:47 -04:00 committed by GitHub
parent 29558f2ca4
commit 902e607379
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,6 +39,7 @@ fi
if [[ $exit_status -ne 0 ]]; then
echo "::warning::Unable to determine the current head sha"
git remote remove temp_changed_files
exit 1
fi
@ -54,6 +55,7 @@ if [[ -z $GITHUB_BASE_REF ]]; then
if [[ $exit_status -ne 0 ]]; then
echo "::warning::Unable to determine the previous commit sha"
echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage"
git remote remove temp_changed_files
exit 1
fi
else
@ -68,6 +70,7 @@ else
if [[ $exit_status -ne 0 ]]; then
echo "::warning::Unable to determine the base ref sha for ${TARGET_BRANCH}"
git remote remove temp_changed_files
exit 1
fi
fi