Skip to content

Commit 95a211d

Browse files
swisskymarcusbellamyshaw-cell
authored andcommitted
ci: opt in to checkout v7 fork guard in workflow_run apply jobs (emdash-cms#1906)
actions/checkout v7 refuses to check out fork PR code from a workflow_run workflow unless the step explicitly sets allow-unsafe-pr-checkout: true. Since the v7 bump (emdash-cms#1611), every "Query Counts — Apply" and "Auto Format — Apply" run that reaches the fork checkout fails with "Refusing to check out fork pull request code", so fork PRs no longer get snapshot updates or auto-formatting pushed back. Both jobs were already designed for this trust boundary: they never execute code from the fork tree — they only apply inert artifacts produced by the trusted measure/format runs (JSON copies, git apply) and push with a scoped app token via GIT_ASKPASS, with persist-credentials: false. Opt in explicitly and document why the checkout is safe.
1 parent 85cd588 commit 95a211d

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

.github/workflows/auto-format-apply.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ jobs:
149149
repository: ${{ steps.pr.outputs.full_name }}
150150
ref: ${{ steps.pr.outputs.sha }}
151151
persist-credentials: false
152+
# Reviewed opt-in to checkout v7's fork guard: no code from the
153+
# fork tree is ever executed here. The steps below only `git apply`
154+
# the patch from the trusted format artifact and run git
155+
# add/commit/push — no scripts, hooks, or tooling from the
156+
# checked-out tree. Credentials are not persisted; the push uses
157+
# a scoped app token via GIT_ASKPASS.
158+
allow-unsafe-pr-checkout: true
152159

153160
- name: Apply patch
154161
if: steps.download.outputs.found == 'true'

.github/workflows/query-counts-apply.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ jobs:
154154
repository: ${{ steps.pr.outputs.full_name }}
155155
ref: ${{ steps.pr.outputs.sha }}
156156
persist-credentials: false
157+
# Reviewed opt-in to checkout v7's fork guard: no code from the
158+
# fork tree is ever executed here. The steps below only copy the
159+
# inert snapshot JSONs from the trusted measure artifact and run
160+
# git add/commit/push — no scripts, hooks, or tooling from the
161+
# checked-out tree. Credentials are not persisted; the push uses
162+
# a scoped app token via GIT_ASKPASS.
163+
allow-unsafe-pr-checkout: true
157164

158165
- name: Apply snapshots
159166
if: steps.download.outputs.found == 'true'

0 commit comments

Comments
 (0)