From 36fecd8462baa825da357f7d8d8f5ede49eee8a1 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Mon, 19 Dec 2022 01:44:25 -0700 Subject: [PATCH 1/2] chore: update test and fixed bug with since_last_remote commit --- .github/workflows/test.yml | 1 - diff-sha.sh | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1dafef2b75a..1d6e5083305 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,6 @@ on: - "**" pull_request: types: - - closed - opened - synchronize - reopened diff --git a/diff-sha.sh b/diff-sha.sh index f825c0465ae..61a499d91fd 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -194,12 +194,10 @@ else if [[ -z $INPUT_BASE_SHA ]]; then if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "true" ]]; then - echo "::debug::Fetching remote current branch..." - PREVIOUS_SHA=$GITHUB_EVENT_BEFORE - + if ! git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1; then - PREVIOUS_SHA=$(git rev-parse origin/"$CURRENT_BRANCH") + PREVIOUS_SHA=$(git rev-parse "$CURRENT_BRANCH^1") fi else echo "::debug::Fetching remote target branch..." From ebf5d237f4cc61908ed704ef8cee09689b4b9d48 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Mon, 19 Dec 2022 01:47:12 -0700 Subject: [PATCH 2/2] Updated to use the base sha --- diff-sha.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diff-sha.sh b/diff-sha.sh index 61a499d91fd..efe250978f0 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -197,7 +197,7 @@ else PREVIOUS_SHA=$GITHUB_EVENT_BEFORE if ! git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1; then - PREVIOUS_SHA=$(git rev-parse "$CURRENT_BRANCH^1") + PREVIOUS_SHA=$GITHUB_EVENT_PULL_REQUEST_BASE_SHA fi else echo "::debug::Fetching remote target branch..."