diff --git a/diff-sha.sh b/diff-sha.sh index 815ae428bd2..7e84f6b3808 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -42,8 +42,9 @@ echo "::debug::Getting HEAD SHA..." if [[ -z $INPUT_SHA ]]; then if [[ -n "$INPUT_UNTIL" ]]; then - echo "::debug::Getting HEAD SHA for '$INPUT_UNTIL'..." CURRENT_SHA=$(git log -1 --format="%H" --date=local --until="$INPUT_UNTIL") && exit_status=$? || exit_status=$? + + echo "::debug::Current SHA for '$INPUT_UNTIL': $CURRENT_SHA" if [[ $exit_status -ne 0 ]]; then echo "::error::Invalid until date: $INPUT_UNTIL" @@ -76,12 +77,9 @@ if [[ -z $GITHUB_BASE_REF ]]; 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 + + echo "::debug::Previous SHA for '$INPUT_SINCE': $PREVIOUS_SHA" if [[ -z "$PREVIOUS_SHA" ]]; then echo "::error::Unable to locate a previous commit for the specified date: $INPUT_SINCE"