3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-01-17 19:17:45 +00:00

fix: bug with retrieving the last remote commit

This commit is contained in:
Tonye Jack 2022-11-15 10:29:27 -07:00 committed by GitHub
parent 3ebdc42d8b
commit 839d5701db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -187,11 +187,7 @@ else
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE PREVIOUS_SHA=$GITHUB_EVENT_BEFORE
if ! git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1; then if ! git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1; then
PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$? PREVIOUS_SHA=$(git rev-parse "$(git branch -r --sort=-committerdate | head -1)" 2>&1) && exit_status=$? || exit_status=$?
fi
if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "0000000000000000000000000000000000000000" ]]; then
PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$?
fi fi
else else
PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$? PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$?