Skip to content

Commit

Permalink
[Security]: Prevent persisting the remote when there are errors (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 authored Oct 27, 2021
1 parent 29558f2 commit 902e607
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 902e607

Please sign in to comment.