Skip to content

Commit 13809b8

Browse files
committed
Merge bitcoin/bitcoin#33303: ci: Checkout latest merged pulls
fa8f081 ci: Checkout latest merged pulls (MarcoFalke) Pull request description: Currently, the `actions/checkout@v5` checks out pull requests merged against master, which is what we want. However, it checks out ancient/stale merge commits on a re-run. This is documented (https://docs.github.com/en/actions/how-tos/manage-workflow-runs/re-run-workflows-and-jobs): > Re-run workflows [...] will also use the same GITHUB_SHA (commit SHA) and GITHUB_REF (git ref) of the original event that triggered the workflow run. For example: * https://github.com/bitcoin/bitcoin/actions/runs/17458152407/job/49579638898?pr=29641#step:9:914 compiles with IPC=ON, even though latest master is at ed2ff3c * bitcoin/bitcoin#32989 (comment) (example explained in comment) This is problematic, because: * Unrelated CI failures and intermittent issues, which are fixed or worked around in latest master can not be cleaned by re-running the task. The author has to actively go out and (force-)push the branch, invalidating review. * It is odd to have a recent CI run, but it uses code and config from the past. * Detecting silent merge conflicts by re-running the CI task is impossible. Fix all issues by checking out the latest merged state of the pull request. The behavior is unchanged for non-pull-request actions. This patch changes the "re-run" default behaviour. Forcing it to use the new state instead of running the old state again. ACKs for top commit: janb84: re ACK fa8f081 hebasto: ACK fa8f081. Tree-SHA512: c22c6f837402f61ec46be46817473e1946424b5312e36ed0e246cadb1ca89c04163bb471f71c309765a3d327f198a83cd83679d231f03828a99a97562a622fdd
2 parents e749205 + fa8f081 commit 13809b8

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ jobs:
133133
BASE_ROOT_DIR: ${{ github.workspace }}
134134

135135
steps:
136-
- name: Checkout
136+
- &CHECKOUT
137+
name: Checkout
137138
uses: actions/checkout@v5
139+
with:
140+
# Ensure the latest merged pull request state is used, even on re-runs.
141+
ref: &CHECKOUT_REF_TMPL ${{ github.event_name == 'pull_request' && github.ref || '' }}
138142

139143
- name: Clang version
140144
run: |
@@ -205,8 +209,7 @@ jobs:
205209
job-name: 'Windows native, fuzz, VS 2022'
206210

207211
steps:
208-
- name: Checkout
209-
uses: actions/checkout@v5
212+
- *CHECKOUT
210213

211214
- name: Configure Developer Command Prompt for Microsoft Visual C++
212215
# Using microsoft/setup-msbuild is not enough.
@@ -317,8 +320,7 @@ jobs:
317320
DANGER_CI_ON_HOST_FOLDERS: 1
318321

319322
steps:
320-
- name: Checkout
321-
uses: actions/checkout@v5
323+
- *CHECKOUT
322324

323325
- name: Configure environment
324326
uses: ./.github/actions/configure-environment
@@ -358,8 +360,7 @@ jobs:
358360
TEST_RUNNER_TIMEOUT_FACTOR: 40
359361

360362
steps:
361-
- name: Checkout
362-
uses: actions/checkout@v5
363+
- *CHECKOUT
363364

364365
- name: Download built executables
365366
uses: actions/download-artifact@v4
@@ -500,8 +501,7 @@ jobs:
500501
file-env: './ci/test/00_setup_env_native_msan.sh'
501502

502503
steps:
503-
- name: Checkout
504-
uses: actions/checkout@v5
504+
- *CHECKOUT
505505

506506
- name: Configure environment
507507
uses: ./.github/actions/configure-environment
@@ -544,6 +544,7 @@ jobs:
544544
- name: Checkout
545545
uses: actions/checkout@v5
546546
with:
547+
ref: *CHECKOUT_REF_TMPL
547548
fetch-depth: 0
548549

549550
- name: Configure Docker

0 commit comments

Comments
 (0)