Skip to content

Commit

Permalink
updated get-base-sha.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Sep 25, 2022
1 parent 7de6088 commit b50afac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ runs:
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
GITHUB_EVENT_BEFORE: ${{ github.event.before }}
GITHUB_EVENT_FORCED : ${{ github.event.forced }}
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
INPUT_SINCE: ${{ inputs.since }}
Expand Down
7 changes: 5 additions & 2 deletions get-base-sha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ if [[ -n "$INPUT_SINCE" ]]; then
elif [[ -n "$INPUT_BASE_SHA" ]]; then
echo "::set-output name=base_sha::$INPUT_BASE_SHA"
elif [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "true" ]]; then
LAST_REMOTE_COMMIT="$GITHUB_EVENT_BEFORE"
LAST_REMOTE_COMMIT=""

if [[ "$GITHUB_EVENT_FORCED" == "false" ]]; then
LAST_REMOTE_COMMIT=$GITHUB_EVENT_BEFORE
fi

if [[ -z "$LAST_REMOTE_COMMIT" || "$LAST_REMOTE_COMMIT" == "0000000000000000000000000000000000000000" ]]; then
echo "::debug::First commit detected"
LAST_REMOTE_COMMIT=$(git rev-parse "$(git branch -r --sort=-committerdate | head -1 | xargs)")
fi
if [[ "$INPUT_SHA" == "$LAST_REMOTE_COMMIT" ]]; then
Expand Down

0 comments on commit b50afac

Please sign in to comment.