Skip to content

Commit 3ff8ff6

Browse files
committed
Include changes to the target branch when action is re-run
When a GitHub action is re-run, it uses the same context as the original run. This means that it runs on the exact same merge commit and does not pick up changes done to the base branch since the last run. In case the base branch is was failing when a PR was opened, this means that we can’t get CI to pass by fixing the base branch without pushing a new commit to the PR branch. Adding `ref: ${{ github.ref }}` to the `actions/checkout` action works around this by checking out the PR merge ref (ie. `refs/pull/<pr_number>/merge`) instead of a fixed commit and the PR merge ref is updated, as described in actions/checkout#1036.
1 parent 814f583 commit 3ff8ff6

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

.github/workflows/soundness.yml

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
with:
8484
persist-credentials: false
8585
submodules: true
86+
ref: ${{ github.ref }} # Include changes to the target branch when action is re-run https://github.com/actions/checkout/issues/1036
8687
- name: Mark the workspace as safe
8788
# https://github.com/actions/checkout/issues/766
8889
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}

.github/workflows/swift_package_test.yml

+4
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ jobs:
6868
run: swift --version
6969
- name: Checkout repository
7070
uses: actions/checkout@v4
71+
with:
72+
ref: ${{ github.ref }} # Include changes to the target branch when action is re-run https://github.com/actions/checkout/issues/1036
7173
- name: Set environment variables
7274
if: ${{ inputs.linux_env_vars }}
7375
run: |
@@ -93,6 +95,8 @@ jobs:
9395
steps:
9496
- name: Checkout repository
9597
uses: actions/checkout@v4
98+
with:
99+
ref: ${{ github.ref }} # Include changes to the target branch when action is re-run https://github.com/actions/checkout/issues/1036
96100
- name: Pull Docker image
97101
id: pull_docker_image
98102
run: |

0 commit comments

Comments
 (0)