ci(preview): a maintainer's preview label previews a pull request from a fork #4

Merged
HumanBean merged 1 commit from ci-preview-label into main 2026-11-13 05:34:45 +00:00
Owner

A pull request from a fork gets no preview, because the workflow would run its code with the Cloudflare token. This lets a maintainer approve one: after reading its changes, add the label preview.

  • pull_request_target on labeled runs the workflow from main, not from the PR, with the secrets.
  • The job checks out refs/pull/<n>/head and fails if the PR has moved past the commit it was at when labelled. Then it uploads and comments as usual, and takes the label off, so a later push needs the label again.
  • PRs from a branch of Site are previewed on every push, as before.
  • README: the label, in the previews paragraph.

Testing: this PR's own run covers the same-repo path with the new checkout (refs/pull/<n>/head) and the commit check. The label path runs from main, so it can only be tried after merging, on #1.

🤖 Generated with Claude Code

A pull request from a fork gets no preview, because the workflow would run its code with the Cloudflare token. This lets a maintainer approve one: after reading its changes, add the label `preview`. - `pull_request_target` on `labeled` runs the workflow from `main`, not from the PR, with the secrets. - The job checks out `refs/pull/<n>/head` and fails if the PR has moved past the commit it was at when labelled. Then it uploads and comments as usual, and takes the label off, so a later push needs the label again. - PRs from a branch of Site are previewed on every push, as before. - README: the label, in the previews paragraph. Testing: this PR's own run covers the same-repo path with the new checkout (`refs/pull/<n>/head`) and the commit check. The label path runs from `main`, so it can only be tried after merging, on #1. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ci(preview): a maintainer's preview label previews a pull request from a fork
All checks were successful
Preview / Preview on Cloudflare (pull_request) Successful in 14s
083045d258
The label approves the commit the PR is at: pull_request_target runs main's workflow, checks the PR is still at that
commit, uploads it, and takes the label off, so a later push needs the label again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
<!-- preview-deploy --> **Preview:** https://pr-4-magicbean-site.hckr-5e0.workers.dev This commit (083045d25829) on its own: https://dbc8f0b2-magicbean-site.hckr-5e0.workers.dev
Sign in to join this conversation.
No reviewers
No labels
preview
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Site!4
No description provided.