Skip to content

Commit

Permalink
Update diff-sha.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Oct 15, 2022
1 parent 61ed208 commit fbf11de
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions diff-sha.sh
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit fbf11de

Please sign in to comment.