Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ if [[ $exit_status -ne 0 ]]; then
fi

if [[ -z $GITHUB_BASE_REF ]]; then
TARGET_BRANCH=${GITHUB_REF/refs\/heads\//}
CURRENT_BRANCH=$TARGET_BRANCH

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
PREVIOUS_SHA=$INPUT_BASE_SHA
fi
TARGET_BRANCH=${GITHUB_REF/refs\/heads\//}
CURRENT_BRANCH=$TARGET_BRANCH

if [[ $exit_status -ne 0 ]]; then
echo "::warning::Unable to determine the previous commit sha"
Expand Down