Skip to content

Commit

Permalink
chore: update the default sha (#896)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Dec 26, 2022
1 parent 61648e7 commit 8a5f628
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion action.yml
Expand Up @@ -46,7 +46,6 @@ inputs:
sha:
description: "Specify a different commit SHA used for comparing changes"
required: false
default: ${{ github.sha }}
base_sha:
description: "Specify a different base commit SHA used for comparing changes"
required: false
Expand Down Expand Up @@ -174,6 +173,7 @@ runs:
GITHUB_SERVER_URL: ${{ github.server_url }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REF: ${{ github.ref }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_BASE_REF: ${{ github.base_ref }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
GITHUB_WORKSPACE: ${{ github.workspace }}
Expand Down
13 changes: 5 additions & 8 deletions diff-sha.sh
Expand Up @@ -54,6 +54,11 @@ if [[ -z $GITHUB_BASE_REF ]]; then
echo "Running on a push event..."
TARGET_BRANCH=$GITHUB_REFNAME
CURRENT_BRANCH=$TARGET_BRANCH

echo "Fetching remote refs..."

# shellcheck disable=SC2086
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$CURRENT_BRANCH" 1>/dev/null 2>&1

echo "::debug::Getting HEAD SHA..."
if [[ -n "$INPUT_UNTIL" ]]; then
Expand All @@ -68,8 +73,6 @@ if [[ -z $GITHUB_BASE_REF ]]; then
if [[ -z $INPUT_SHA ]]; then
CURRENT_SHA=$(git rev-list -n 1 HEAD) && exit_status=$? || exit_status=$?
else
# shellcheck disable=SC2086
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$CURRENT_BRANCH" 1>/dev/null 2>&1
CURRENT_SHA=$INPUT_SHA; exit_status=$?
fi
fi
Expand Down Expand Up @@ -131,8 +134,6 @@ if [[ -z $GITHUB_BASE_REF ]]; then
fi
fi
else
# shellcheck disable=SC2086
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$CURRENT_BRANCH" 1>/dev/null 2>&1
PREVIOUS_SHA=$INPUT_BASE_SHA
fi

Expand Down Expand Up @@ -174,10 +175,6 @@ else
CURRENT_SHA=$(git rev-list -n 1 HEAD) && exit_status=$? || exit_status=$?
else
CURRENT_SHA=$INPUT_SHA; exit_status=$?

if [[ "$CURRENT_SHA" == "$GITHUB_EVENT_PULL_REQUEST_HEAD_SHA" ]]; then
CURRENT_SHA=$(git rev-list -n 1 HEAD) && exit_status=$? || exit_status=$?
fi
fi
fi

Expand Down

0 comments on commit 8a5f628

Please sign in to comment.