From d8ae75228d4d40e5ab140fbef3faff1ca55140c6 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sat, 15 Oct 2022 17:25:37 -0600 Subject: [PATCH] Updated diff-sha.sh --- diff-sha.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/diff-sha.sh b/diff-sha.sh index 815ae428bd2..4d97f2f635d 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -73,21 +73,17 @@ if [[ -z $GITHUB_BASE_REF ]]; then CURRENT_BRANCH=$TARGET_BRANCH && exit_status=$? || exit_status=$? if [[ -z $INPUT_BASE_SHA ]]; then - git fetch --no-tags -u --progress origin --depth="$INPUT_TARGET_BRANCH_FETCH_DEPTH" "${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$? - if [[ -n "$INPUT_SINCE" ]]; then echo "::debug::Getting base SHA for '$INPUT_SINCE'..." - PREVIOUS_SHA=$(git log --format="%H" --date=local --since="$INPUT_SINCE" --reverse | head -n 1) - - git log --format="%H" --date=local --since="$INPUT_SINCE" --reverse | grep -n "$PREVIOUS_SHA" - - git log --format="%H" --date=local --since="$INPUT_SINCE" --reverse + PREVIOUS_SHA=$(git log --format="%H" --date=local --since="$INPUT_SINCE" | tail -1) && exit_status=$? || exit_status=$? if [[ -z "$PREVIOUS_SHA" ]]; then echo "::error::Unable to locate a previous commit for the specified date: $INPUT_SINCE" exit 1 fi else + git fetch --no-tags -u --progress origin --depth="$INPUT_TARGET_BRANCH_FETCH_DEPTH" "${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$? + PREVIOUS_SHA="" if [[ "$GITHUB_EVENT_FORCED" == "false" ]]; then