fix(ci): restore preview builds for fork PRs behind an approval gate - #3671
Merged
Conversation
actions/checkout v7 refuses to check out fork PR code under pull_request_target unless allow-unsafe-pr-checkout is set, so every fork PR failed the preview build. Opt in, but gate the job on an environment for fork PRs only: a fork controls the Dockerfile and everything it RUNs, which executes on a runner holding packages: write. Same-repo PRs use an unprotected environment and still build without a click.
The environment string form carries no url, so the PR timeline showed a bare deployment entry. Point it at the pr-N preview to get a clickable "View deployment" button.
Preview DeploymentPreview deployments for this PR are available at:
The preview environment will start automatically on first visit. Subsequent pushes to this PR will update the Run locally with Dockerdocker pull ghcr.io/go-vikunja/vikunja:pr-3671
docker run -p 3456:3456 ghcr.io/go-vikunja/vikunja:pr-3671Last updated for commit e9d9cc5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Preview build fails on every fork PR since actions/checkout v7:
Refusing to check out fork pull request code from a 'pull_request_target' workflow.Opt in via
allow-unsafe-pr-checkout, but add gate. Fork controlsDockerfileand everything itRUNs, executing on runner that holdspackages: write— so fork PRs now route to apreview-forkenvironment with required reviewers. Same-repo PRs usepreview-trusted(no protection rules), build unattended as before.Blocks merge: both environments must exist in repo settings first. GitHub auto-creates a missing environment unprotected, so
preview-forkwould silently pass through and forks would build ungated.preview-trusted— no protection rulespreview-fork— required reviewers: @kolaenteHow to verify
dockerjob of the Preview workflow reports "Waiting for review" and does not start until a required reviewer approves it. After approval the job runs to completion and the preview comment appears on the PR.Refusing to check out fork pull request code.Then check a same-repo pull request:
dockerjob starts immediately with no approval prompt, and the preview comment appears as before.