Skip to content

fix: add allow-unsafe-pr-checkout to all checkout steps for pull_request_target - #308

Open
CodingAngel1 wants to merge 1 commit into
AetherEdu:mainfrom
CodingAngel1:fix/ci-pull-request-target-checkout
Open

fix: add allow-unsafe-pr-checkout to all checkout steps for pull_request_target#308
CodingAngel1 wants to merge 1 commit into
AetherEdu:mainfrom
CodingAngel1:fix/ci-pull-request-target-checkout

Conversation

@CodingAngel1

Copy link
Copy Markdown
Contributor

Problem

CI is failing on all fork pull requests with:

Error: Refusing to check out fork pull request code from a 'pull_request_target' workflow.
To opt in, set 'allow-unsafe-pr-checkout: true' on the actions/checkout step.

Root Cause

Commit f8aced9 switched the workflow trigger from pull_request to pull_request_target so CI runs automatically on PR creation. However, pull_request_target blocks 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: true to all 4 actions/checkout@v4 steps in .github/workflows/ci.yml.

Note: Because pull_request_target runs the workflow from the base branch (main), this fix must be merged to main before it takes effect on PR #307 and any other fork PRs.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant