From 839d5701dbdeedacaaa60ae5c9a8106cccc6f78b Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 15 Nov 2022 10:29:27 -0700 Subject: [PATCH] fix: bug with retrieving the last remote commit --- diff-sha.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/diff-sha.sh b/diff-sha.sh index e6de07d1..e6cf0cd2 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -187,11 +187,7 @@ else PREVIOUS_SHA=$GITHUB_EVENT_BEFORE 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=$? - fi - - if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "0000000000000000000000000000000000000000" ]]; 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 else PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$?