fix: add allow-unsafe-pr-checkout to all checkout steps for pull_request_target - #308
Open
CodingAngel1 wants to merge 1 commit into
Open
Conversation
…est_target The CI workflow runs with pull_request_target which refuses to checkout fork PR code by default. Since the workflow explicitly references the PR head SHA (ref), adding allow-unsafe-pr-checkout: true is required for fork PRs to build. This fix must land on main because pull_request_target always runs the workflow from the base branch, not the PR branch.
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.
Problem
CI is failing on all fork pull requests with:
Root Cause
Commit
f8aced9switched the workflow trigger frompull_requesttopull_request_targetso CI runs automatically on PR creation. However,pull_request_targetblocks fork PR checkouts by default for security.The workflow already explicitly checks out the PR head SHA via
ref: ${{ github.event.pull_request.head.sha || github.ref }}, so the intention was always to build fork PR code.Fix
Added
allow-unsafe-pr-checkout: trueto all 4actions/checkout@v4steps in.github/workflows/ci.yml.Note: Because
pull_request_targetruns the workflow from the base branch (main), this fix must be merged tomainbefore it takes effect on PR #307 and any other fork PRs.