From 7939ced35ebff30c8a6e223503d68286f979c797 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Fri, 23 Sep 2022 22:56:09 -0600 Subject: [PATCH] feat: add support for closed pull requests with merge true Closes: #635 --- diff-sha.sh | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/diff-sha.sh b/diff-sha.sh index 1e17d360..9116f3ba 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -96,18 +96,9 @@ else echo "::debug::GITHUB_BASE_REF: $TARGET_BRANCH..." if [[ -z $INPUT_BASE_SHA ]]; then - if [[ "$INPUT_USE_FORK_POINT" == "true" ]]; then - echo "::debug::Getting fork point..." - git fetch --no-tags -u --progress origin "${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$? - PREVIOUS_SHA=$(git merge-base --fork-point "${TARGET_BRANCH}" "$(git name-rev --name-only "$CURRENT_SHA")") && exit_status=$? || exit_status=$? - echo "::debug::Previous SHA: $PREVIOUS_SHA" - else - git fetch --no-tags -u --progress origin --depth=1 "${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$? - PREVIOUS_SHA=$(git rev-list -n 1 "${TARGET_BRANCH}" 2>&1) && exit_status=$? || exit_status=$? - echo "::debug::Previous SHA: $PREVIOUS_SHA" - fi + PREVIOUS_SHA=$GITHUB_PULL_REQUEST_BASE_SHA && exit_status=$? || exit_status=$? + echo "::debug::Previous SHA: $PREVIOUS_SHA" else - git fetch --no-tags -u --progress origin --depth=1 "$(git rev-parse --verify "$INPUT_BASE_SHA")" && exit_status=$? || exit_status=$? PREVIOUS_SHA=$INPUT_BASE_SHA TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) && exit_status=$? || exit_status=$? echo "::debug::Previous SHA: $PREVIOUS_SHA"