From 839d5701dbdeedacaaa60ae5c9a8106cccc6f78b Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 15 Nov 2022 10:29:27 -0700 Subject: [PATCH 1/7] fix: bug with retrieving the last remote commit --- diff-sha.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/diff-sha.sh b/diff-sha.sh index e6de07d1851..e6cf0cd27c1 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -187,11 +187,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-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$? - fi - - if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "0000000000000000000000000000000000000000" ]]; then - PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$? + PREVIOUS_SHA=$(git rev-parse "$(git branch -r --sort=-committerdate | head -1)" 2>&1) && exit_status=$? || exit_status=$? fi else PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$? From 3e827ae4d1aabf31ec4bd636797dd9fdce4a47a3 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 15 Nov 2022 10:38:56 -0700 Subject: [PATCH 2/7] Update diff-sha.sh --- diff-sha.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/diff-sha.sh b/diff-sha.sh index e6cf0cd27c1..434bab4c0b9 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -187,7 +187,8 @@ 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 "$(git branch -r --sort=-committerdate | head -1)" 2>&1) && exit_status=$? || exit_status=$? + # shellcheck disable=SC2046 + PREVIOUS_SHA=$(git rev-parse $(git branch -r --sort=-committerdate | head -1) 2>&1) && exit_status=$? || exit_status=$? fi else PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$? From 07952792bb873da4ff1be696fe0539fd3db9effa Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 15 Nov 2022 10:43:14 -0700 Subject: [PATCH 3/7] Update test.yml --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c641ea12233..646a8aae602 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,6 +27,8 @@ jobs: uses: actions/checkout@v3 - name: shellcheck uses: reviewdog/action-shellcheck@v1.15 + with: + github_token: ${{ secrets.PAT_TOKEN }} test-multiple-repositories: name: Test with multiple repositories From 1bf2487713d5da6ef6fedd570c1d30b59f483b79 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 15 Nov 2022 10:45:13 -0700 Subject: [PATCH 4/7] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 646a8aae602..c09fa4fcb0d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -931,7 +931,7 @@ jobs: with: branch: ${{ steps.branch-name.outputs.base_ref_branch }} workflow_id: 'test.yml' - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.PAT_TOKEN }} - name: Run changed-files with a custom base sha if: github.event_name == 'pull_request' && github.event.action != 'closed' id: changed-files-custom-base-sha From e7e332ee69fd78b009e2e80714ffd693573da5d9 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 15 Nov 2022 10:50:44 -0700 Subject: [PATCH 5/7] Update sync-release-version.yml --- .github/workflows/sync-release-version.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/sync-release-version.yml b/.github/workflows/sync-release-version.yml index 127c444a9c8..463810e0901 100644 --- a/.github/workflows/sync-release-version.yml +++ b/.github/workflows/sync-release-version.yml @@ -1,8 +1,5 @@ name: Update release version. on: - push: - tags: - - '**' release: types: [published] From 4203489288873ed8a126dc274b0bf9e4a155e4a4 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 15 Nov 2022 11:08:51 -0700 Subject: [PATCH 6/7] Update diff-sha.sh --- diff-sha.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/diff-sha.sh b/diff-sha.sh index 434bab4c0b9..fb60c281599 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -211,16 +211,18 @@ else depth=$INPUT_FETCH_DEPTH max_depth=$INPUT_MAX_FETCH_DEPTH - while [ -z "$( git merge-base --fork-point "$TARGET_BRANCH" "$CURRENT_SHA" )" ] || [ -z "$(git merge-base "$TARGET_BRANCH" "$CURRENT_SHA")" ] || [ -z "$(git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA"..."$CURRENT_SHA" | head -1)" ]; do - depth=$((depth + 300)) + while ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA"..."$CURRENT_SHA" 1>/dev/null; do + echo "Fetching $depth commits..." # shellcheck disable=SC2086 - git fetch $EXTRA_ARGS --deepen="$depth" origin "$TARGET_BRANCH" HEAD; + git fetch $EXTRA_ARGS --deepen="$depth" origin "$TARGET_BRANCH" "$CURRENT_SHA"; if [[ $depth -gt $max_depth ]]; then - echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and HEAD" + echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and "$CURRENT_SHA"" exit 1 fi + + depth=$((depth + 300)) done else echo "::debug::Not a shallow clone, skipping merge-base check." From e447432ead1b4c85f8de0024e8b66996270c95a2 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 15 Nov 2022 11:11:36 -0700 Subject: [PATCH 7/7] 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 fb60c281599..3cdd64ef38c 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -218,7 +218,7 @@ else git fetch $EXTRA_ARGS --deepen="$depth" origin "$TARGET_BRANCH" "$CURRENT_SHA"; if [[ $depth -gt $max_depth ]]; then - echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and "$CURRENT_SHA"" + echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and $CURRENT_SHA" exit 1 fi