From 1f30bd2085b83668fb636f1a1f90744d8adbacca Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Wed, 16 Mar 2022 01:32:30 -0400 Subject: [PATCH] fix: bug omitting the fetch-depth for push based events (#434) --- diff-sha.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/diff-sha.sh b/diff-sha.sh index 153b5414..93d6a1bb 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -52,10 +52,13 @@ if [[ -z $GITHUB_BASE_REF ]]; then CURRENT_BRANCH=$TARGET_BRANCH if [[ -z $INPUT_BASE_SHA ]]; then + git fetch --no-tags -u --progress --depth=2 temp_changed_files "${CURRENT_BRANCH}":"${CURRENT_BRANCH}" && exit_status=$? || exit_status=$? + if [[ $(git rev-list --count HEAD) -gt 1 ]]; then PREVIOUS_SHA=$(git rev-list --no-merges -n 1 HEAD^1 2>&1) && exit_status=$? || exit_status=$? else PREVIOUS_SHA=$CURRENT_SHA + echo "Initial commit detected" fi else PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$?