Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix commit ref for integration tests workflow #870

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading