Skip to content

Commit 9108369

Browse files
authored
Fix checkout target for pull request workflows (#212)
when using `pull_request_target:` the default ref is main so all checks are run from the main branch rather than the PR. This re-targets all checkouts to a generated `merge_commit` which matches the behavior of `pull_request:`. ([ref](actions/checkout#518))
1 parent 56384a2 commit 9108369

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/development.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
python: ["3.9", "3.13"]
1313
steps:
1414
- uses: actions/checkout@v4
15+
with:
16+
ref: "${{ github.event.pull_request.merge_commit_sha }}"
1517
- name: Set up Python
1618
uses: actions/setup-python@v5
1719
with:
@@ -28,6 +30,8 @@ jobs:
2830
steps:
2931
- name: Check out code
3032
uses: actions/checkout@v3
33+
with:
34+
ref: "${{ github.event.pull_request.merge_commit_sha }}"
3135

3236
- name: Install dependencies
3337
run: npm ci
@@ -42,6 +46,8 @@ jobs:
4246
python: ["3.9", "3.13"]
4347
steps:
4448
- uses: actions/checkout@v4
49+
with:
50+
ref: "${{ github.event.pull_request.merge_commit_sha }}"
4551
- name: Set up Python
4652
uses: actions/setup-python@v5
4753
with:
@@ -58,6 +64,8 @@ jobs:
5864
steps:
5965
- name: Check out code
6066
uses: actions/checkout@v3
67+
with:
68+
ref: "${{ github.event.pull_request.merge_commit_sha }}"
6169

6270
- name: Install dependencies
6371
run: npm ci
@@ -72,6 +80,8 @@ jobs:
7280
python: ["3.9"]
7381
steps:
7482
- uses: actions/checkout@v4
83+
with:
84+
ref: "${{ github.event.pull_request.merge_commit_sha }}"
7585
- name: Set up Python
7686
uses: actions/setup-python@v5
7787
with:
@@ -88,6 +98,8 @@ jobs:
8898
steps:
8999
- name: Check out code
90100
uses: actions/checkout@v3
101+
with:
102+
ref: "${{ github.event.pull_request.merge_commit_sha }}"
91103

92104
- name: Install dependencies
93105
run: npm ci
@@ -102,6 +114,8 @@ jobs:
102114
python: ["3.9", "3.13"]
103115
steps:
104116
- uses: actions/checkout@v4
117+
with:
118+
ref: "${{ github.event.pull_request.merge_commit_sha }}"
105119
- name: Set up Python
106120
uses: actions/setup-python@v5
107121
with:
@@ -132,6 +146,8 @@ jobs:
132146
python: ["3.9", "3.13"]
133147
steps:
134148
- uses: actions/checkout@v4
149+
with:
150+
ref: "${{ github.event.pull_request.merge_commit_sha }}"
135151
- name: Set up Python
136152
uses: actions/setup-python@v5
137153
with:
@@ -148,6 +164,8 @@ jobs:
148164
steps:
149165
- name: Check out code
150166
uses: actions/checkout@v3
167+
with:
168+
ref: "${{ github.event.pull_request.merge_commit_sha }}"
151169

152170
- name: Install dependencies
153171
run: npm ci
@@ -165,6 +183,7 @@ jobs:
165183
uses: actions/checkout@v4
166184
with:
167185
fetch-depth: 0
186+
ref: "${{ github.event.pull_request.merge_commit_sha }}"
168187
- name: Set up Python
169188
uses: actions/setup-python@v5
170189
with:

0 commit comments

Comments
 (0)