From 0bb63863ed2a07e65481e409799f92da402484bb Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sun, 25 Dec 2022 21:51:10 -0700 Subject: [PATCH 1/6] chore: update the default sha --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 3e19148d3a0..98884136dd1 100644 --- a/action.yml +++ b/action.yml @@ -46,7 +46,6 @@ inputs: sha: description: "Specify a different commit SHA used for comparing changes" required: false - default: ${{ github.sha }} base_sha: description: "Specify a different base commit SHA used for comparing changes" required: false @@ -174,6 +173,7 @@ runs: GITHUB_SERVER_URL: ${{ github.server_url }} GITHUB_REPOSITORY: ${{ github.repository }} GITHUB_REF: ${{ github.ref }} + GITHUB_SHA: ${{ github.sha }} GITHUB_BASE_REF: ${{ github.base_ref }} GITHUB_HEAD_REF: ${{ github.head_ref }} GITHUB_WORKSPACE: ${{ github.workspace }} From 16677c16494329574cdaa1d361ae7c1968d275b7 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sun, 25 Dec 2022 21:53:33 -0700 Subject: [PATCH 2/6] Update diff-sha.sh --- diff-sha.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diff-sha.sh b/diff-sha.sh index efe250978f0..62ecc184869 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -66,7 +66,7 @@ if [[ -z $GITHUB_BASE_REF ]]; then fi else if [[ -z $INPUT_SHA ]]; then - CURRENT_SHA=$(git rev-list -n 1 HEAD) && exit_status=$? || exit_status=$? + CURRENT_SHA=$GITHUB_SHA && exit_status=$? || exit_status=$? else # shellcheck disable=SC2086 git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$CURRENT_BRANCH" 1>/dev/null 2>&1 @@ -171,7 +171,7 @@ else fi else if [[ -z $INPUT_SHA ]]; then - CURRENT_SHA=$(git rev-list -n 1 HEAD) && exit_status=$? || exit_status=$? + CURRENT_SHA=$GITHUB_EVENT_PULL_REQUEST_HEAD_SHA && exit_status=$? || exit_status=$? else CURRENT_SHA=$INPUT_SHA; exit_status=$? From d6bd937749059194bd0f261a37f376d2cc05bce7 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sun, 25 Dec 2022 21:55:22 -0700 Subject: [PATCH 3/6] Update diff-sha.sh --- diff-sha.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/diff-sha.sh b/diff-sha.sh index 62ecc184869..98708fdadc5 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -174,10 +174,6 @@ else CURRENT_SHA=$GITHUB_EVENT_PULL_REQUEST_HEAD_SHA && exit_status=$? || exit_status=$? else CURRENT_SHA=$INPUT_SHA; exit_status=$? - - if [[ "$CURRENT_SHA" == "$GITHUB_EVENT_PULL_REQUEST_HEAD_SHA" ]]; then - CURRENT_SHA=$(git rev-list -n 1 HEAD) && exit_status=$? || exit_status=$? - fi fi fi From 1dc4d26ac2c81a187032d75037076b80d461fc46 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sun, 25 Dec 2022 21:56:28 -0700 Subject: [PATCH 4/6] Update diff-sha.sh --- diff-sha.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diff-sha.sh b/diff-sha.sh index 98708fdadc5..41362daf9ff 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -66,7 +66,7 @@ if [[ -z $GITHUB_BASE_REF ]]; then fi else if [[ -z $INPUT_SHA ]]; then - CURRENT_SHA=$GITHUB_SHA && exit_status=$? || exit_status=$? + CURRENT_SHA=$(git rev-list -n 1 HEAD) && exit_status=$? || exit_status=$? else # shellcheck disable=SC2086 git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$CURRENT_BRANCH" 1>/dev/null 2>&1 From 949e0cf3dec4336ed5c8fe1b4d92b7abb96c6a70 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sun, 25 Dec 2022 22:09:09 -0700 Subject: [PATCH 5/6] Update diff-sha.sh --- diff-sha.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diff-sha.sh b/diff-sha.sh index 41362daf9ff..0ecd0bf0262 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -171,7 +171,7 @@ else fi else if [[ -z $INPUT_SHA ]]; then - CURRENT_SHA=$GITHUB_EVENT_PULL_REQUEST_HEAD_SHA && exit_status=$? || exit_status=$? + CURRENT_SHA=$(git rev-list -n 1 HEAD) && exit_status=$? || exit_status=$? else CURRENT_SHA=$INPUT_SHA; exit_status=$? fi From 48b64324c536e281c146c88a0cfc038726faf912 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sun, 25 Dec 2022 22:14:16 -0700 Subject: [PATCH 6/6] Update diff-sha.sh --- diff-sha.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/diff-sha.sh b/diff-sha.sh index 0ecd0bf0262..ef02928e56d 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -54,6 +54,11 @@ if [[ -z $GITHUB_BASE_REF ]]; then echo "Running on a push event..." TARGET_BRANCH=$GITHUB_REFNAME CURRENT_BRANCH=$TARGET_BRANCH + + echo "Fetching remote refs..." + + # shellcheck disable=SC2086 + git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$CURRENT_BRANCH" 1>/dev/null 2>&1 echo "::debug::Getting HEAD SHA..." if [[ -n "$INPUT_UNTIL" ]]; then @@ -68,8 +73,6 @@ if [[ -z $GITHUB_BASE_REF ]]; then if [[ -z $INPUT_SHA ]]; then CURRENT_SHA=$(git rev-list -n 1 HEAD) && exit_status=$? || exit_status=$? else - # shellcheck disable=SC2086 - git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$CURRENT_BRANCH" 1>/dev/null 2>&1 CURRENT_SHA=$INPUT_SHA; exit_status=$? fi fi @@ -131,8 +134,6 @@ if [[ -z $GITHUB_BASE_REF ]]; then fi fi else - # shellcheck disable=SC2086 - git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$CURRENT_BRANCH" 1>/dev/null 2>&1 PREVIOUS_SHA=$INPUT_BASE_SHA fi