Skip to content

Commit

Permalink
Fix commit ref for integration tests workflow (#870)
Browse files Browse the repository at this point in the history
Co-authored-by: Joseph H Kennedy <[email protected]>
  • Loading branch information
chuckwondo and jhkennedy authored Nov 5, 2024
1 parent 71d40f7 commit 926b67b
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.head.repo.fork
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -78,16 +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"
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 }}" ]]
# 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 }}

- name: Install package with dependencies
uses: ./.github/actions/install-pkg
Expand Down

0 comments on commit 926b67b

Please sign in to comment.