From a501b5b5642b09ef8866d852a37c266608695ab8 Mon Sep 17 00:00:00 2001 From: Chuck Daniels Date: Tue, 5 Nov 2024 17:17:31 -0500 Subject: [PATCH 1/3] Fix commit ref for integration tests workflow --- .github/workflows/integration-test.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 6b563135..ffdf12d0 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -81,13 +81,14 @@ jobs: # appears that this is the most reasonable way to ensure that we are pulling # the same code that triggered things, based upon this particular comment: # https://github.com/actions/checkout/issues/518#issuecomment-1661941548 - ref: "refs/pull/${{ github.event.number }}/merge" + # ref: "refs/pull/${{ github.event.number }}/merge" + ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 2 - - name: Sanity check - # Continuing from previous comment in checkout step above. - run: | - [[ "$(git rev-parse 'HEAD~2')" == "${{ github.event.pull_request.head.sha }}" ]] + # - name: Sanity check + # # Continuing from previous comment in checkout step above. + # run: | + # [[ "$(git rev-parse 'HEAD~2')" == "${{ github.event.pull_request.head.sha }}" ]] - name: Install package with dependencies uses: ./.github/actions/install-pkg From d1ac2521d8382406801b947dbb2091572bed61d8 Mon Sep 17 00:00:00 2001 From: Chuck Daniels Date: Tue, 5 Nov 2024 17:28:27 -0500 Subject: [PATCH 2/3] Ensure only one of pull_request and pull_request_target run --- .github/workflows/integration-test.yml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index ffdf12d0..aed1cd32 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -32,13 +32,12 @@ jobs: # To prevent this, this condition ensures that integration tests are run # in only ONE of the following cases: # - # 1. The event is NOT a pull_request. This covers the case when the event - # is a pull_request_target (i.e., a PR from a fork), as well as all - # other cases listed in the "on" block at the top of this file. + # 1. The event is NOT a pull_request (it's a pull_request_target) and the base + # repo and the head repo are different (i.e., the PR is from a fork). # 2. The event IS a pull_request AND the base repo and head repo are the # same (i.e., the PR is NOT from a fork). # - if: github.event_name != 'pull_request' || github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name + if: (github.event_name == 'pull_request') == (github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name) runs-on: ubuntu-latest strategy: matrix: @@ -78,17 +77,14 @@ jobs: # a known, problematic issue: https://github.com/actions/checkout/issues/518 # It seems that ideally, we want github.event.pull_request.merge_commit_sha, # but that it is not reliable, and can sometimes be a null values. It - # appears that this is the most reasonable way to ensure that we are pulling - # the same code that triggered things, based upon this particular comment: + # appears that the most reasonable way to ensure that we are pulling the same + # code that triggered things is shown in this issue comment: # https://github.com/actions/checkout/issues/518#issuecomment-1661941548 - # ref: "refs/pull/${{ github.event.number }}/merge" + # However, attempts to get that working resulted in getting an empty + # github.event.number, so we're resorting to this simpler approach, which + # is apparently less than ideal, but seems to be the best we can muster at + # this point. ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 2 - - # - name: Sanity check - # # Continuing from previous comment in checkout step above. - # run: | - # [[ "$(git rev-parse 'HEAD~2')" == "${{ github.event.pull_request.head.sha }}" ]] - name: Install package with dependencies uses: ./.github/actions/install-pkg From 34e1624bebe56a4e0d1486c2b3371faf743a455f Mon Sep 17 00:00:00 2001 From: Chuck Daniels Date: Tue, 5 Nov 2024 18:31:33 -0500 Subject: [PATCH 3/3] Update .github/workflows/integration-test.yml Co-authored-by: Joseph H Kennedy --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index aed1cd32..643e29d9 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -37,7 +37,7 @@ jobs: # 2. The event IS a pull_request AND the base repo and head repo are the # same (i.e., the PR is NOT from a fork). # - if: (github.event_name == 'pull_request') == (github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name) + if: (github.event_name != 'pull_request') && github.event.pull_request.head.repo.fork runs-on: ubuntu-latest strategy: matrix: