Update base_sha to use the last commit on the current branch for push event (#235)

* Update base_sha to use the last commit on the current branch for push events

Resolves: #234

* Update entrypoint.sh

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Tonye Jack 2021-10-27 17:28:58 -04:00 committed by GitHub
parent 9e2f491e3f
commit d924fccc1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,13 +44,14 @@ if [[ $exit_status -ne 0 ]]; then
fi fi
if [[ -z $GITHUB_BASE_REF ]]; then if [[ -z $GITHUB_BASE_REF ]]; then
TARGET_BRANCH=${GITHUB_REF/refs\/heads\//}
CURRENT_BRANCH=$TARGET_BRANCH
if [[ -z $INPUT_BASE_SHA ]]; then if [[ -z $INPUT_BASE_SHA ]]; then
PREVIOUS_SHA=$(git rev-parse HEAD^1 2>&1) && exit_status=$? || exit_status=$? PREVIOUS_SHA=$(git rev-parse "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$?
else else
PREVIOUS_SHA=$INPUT_BASE_SHA PREVIOUS_SHA=$INPUT_BASE_SHA
fi fi
TARGET_BRANCH=${GITHUB_REF/refs\/heads\//}
CURRENT_BRANCH=$TARGET_BRANCH
if [[ $exit_status -ne 0 ]]; then if [[ $exit_status -ne 0 ]]; then
echo "::warning::Unable to determine the previous commit sha" echo "::warning::Unable to determine the previous commit sha"