Skip to content

Commit f652c75

Browse files
gmtatrflynn89
authored andcommitted
CI: Check out PR merge branch instead of source
1 parent b667cd6 commit f652c75

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.github/workflows/cmake.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,17 @@ jobs:
3131
arch: 'x86_64'
3232

3333
steps:
34+
# Pull requests can trail behind `master` and can cause breakage if merging before running the CI checks on an updated branch.
35+
# Luckily, GitHub creates and maintains a merge branch that is updated whenever the target or source branch is modified. By
36+
# checking this branch out, we gain a stabler `master` at the cost of reproducibility.
3437
- uses: actions/checkout@v3
38+
if: ${{ github.event_name != 'pull_request' }}
39+
40+
- uses: actions/checkout@v3
41+
if: ${{ github.event_name == 'pull_request' }}
42+
with:
43+
ref: refs/pull/${{ github.event.pull_request.number }}/merge
44+
3545
# Set default Python to python 3.x, and set Python path such that pip install works properly
3646
- uses: actions/setup-python@v4
3747
with:

0 commit comments

Comments
 (0)