Did a workflow on your public repo fail on November 16 between 16:00 and 18:00 UTC, and then quietly start working again? That wasn't a flaky runner. It was GitHub rehearsing a change.
From December 2, 2026, GitHub Actions blocks pull_request_target by default in public repositories, unless an Actions event policy explicitly allows it. If your auto-labeler, first-time-contributor greeter or preview deploy runs on that trigger, it stops on that day.
This post is for anyone who maintains a public repo on GitHub Free, Team or Enterprise Cloud. In about ten minutes you'll know which of your workflows use the trigger, and for each one, whether to switch it, split it or allow it.
What exactly changes
The short version from GitHub's changelog:
- Who: public repositories on GitHub Free, GitHub Team and GitHub Enterprise Cloud. Private and internal repos aren't affected, and neither is GitHub Enterprise Server.
- When: permanently from December 2, 2026. It was first planned for November 2 and got pushed back a month.
- Rehearsals: two brownouts, on November 9 and November 16, 16:00 to 18:00 UTC. During those windows, blocked runs failed with an error annotation. Outside them, the rule sits in evaluate mode, so runs still go through with a warning.
- Escape hatch: an Actions event policy that explicitly allows
pull_request_target, ideally scoped to specific workflow files.
Both brownouts are done. The next time it blocks, it stays blocked.
Why GitHub is doing this
The two triggers look almost identical, and that's the problem.
pull_request runs the workflow file from the PR's merge commit. For a fork PR, that code belongs to someone with no write access to your repo, so GitHub gives the job a read-only GITHUB_TOKEN and no secrets.
pull_request_target runs the workflow from your default branch instead, with the base repo's GITHUB_TOKEN and access to repository and organization secrets. That's useful for jobs like labelling or commenting on fork PRs. On its own it's safe, because nothing from the fork runs by default.
It turns dangerous the moment the workflow checks out the fork's code and executes it. Here's the shape GitHub's own docs use as the bad example:
# INSECURE. Example only. on: pull_request_target: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} - name: Test run: make test The checkout isn't the bug. The make test line is. It runs a Makefile the PR author wrote, with your secrets in reach. GitHub's docs call this pattern a "pwn request", and it has caused multiple supply-chain compromises.
"Running" is broader than it sounds, too. Build scripts, test configs, npm install lifecycle hooks: any of them can execute code from the PR. You don't need an obvious run: ./evil.sh step to get owned.
Step 1: find every workflow that uses it
Start local. From the repo root:
grep -rln "pull_request_target" .github/workflows If you look after a whole org, GitHub code search does the same job across every repo:
org:YOUR_ORG path:.github/workflows "pull_request_target" A list of files is a start, but you also want to know which ones actually touch PR code. This small Node script (no dependencies, Node 18+) lists every workflow that uses the trigger and flags the lines that check out or fetch code from the PR:
// find-prt.mjs: list workflows that use pull_request_target and flag risky lines import { readdirSync, readFileSync } from "node:fs"; import { join } from "node:path"; const dir = process.argv[2] ?? ".github/workflows"; const risky = [ [/ref:\s*\$\{\{\s*github\.event\.pull_request\.head/, "checks out the PR head"], [/refs\/pull\//, "checks out a PR ref"], [/repository:\s*\$\{\{\s*github\.event\.pull_request\.head\.repo/, "checks out the fork repo"], [/gh pr checkout|git fetch/, "fetches PR code outside actions/checkout"], [/allow-unsafe-pr-checkout/, "opts out of checkout's fork protection"], ]; const files = readdirSync(dir).filter((f) => /\.ya?ml$/.test(f)); for (const file of files) { const lines = readFileSync(join(dir, file), "utf8").split("\n"); if (!lines.some((l) => /^\s*[^#]*pull_request_target/.test(l))) continue; const hits = []; lines.forEach((line, i) => { for (const [re, why] of risky) { if (re.test(line)) hits.push(` line ${i + 1}: ${why}`); } }); console.log(hits.length ? `⚠️ ${file}` : `• ${file} (no PR checkout found)`); hits.forEach((h) => console.log(h)); } Run it with node find-prt.mjs. On a test folder holding the insecure example above plus a plain labeler, it prints:
⚠️ insecure.yml line 11: checks out the PR head • labeler.yml (no PR checkout found) It's a regex pass, not a security audit. It won't catch a script that downloads PR code some other way, so treat a clean result as "look closer at these files", not "all good".
If your account shows policy insights for Actions, check that too. It lists the runs the default rule would have blocked, which is the most accurate list you'll get. (Some maintainers on non-Enterprise orgs report they can't see it, which is why the grep matters.)
Step 2: decide what each workflow should become
Every hit lands in one of three buckets.
It doesn't need secrets → switch to pull_request
This is most CI. Tests, lint, type checks and builds don't need write tokens or secrets to tell you whether a PR is green. Change the trigger and lock down permissions:
on: pull_request permissions: contents: read jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - run: npm ci - run: npm test That's the whole fix for a lot of repos.
It needs secrets but never runs PR code → keep it, allow it on purpose
Labelers, greeting bots and triage jobs often fit here. They read PR metadata and write a label or a comment, and they never check out the fork's code. Here's a labeler that only needs to write to the PR:
on: pull_request_target permissions: contents: read pull-requests: write jobs: label: runs-on: ubuntu-latest steps: - uses: actions/labeler@v5 These are what the event policy exists for. Allow pull_request_target in an Actions event policy and use workflow file targeting so only this file gets the exception. Don't allow it repo-wide just to keep an old workflow green. Policies can be set at the repository, organization or enterprise level. The steps are in GitHub's workflow execution docs.
It needs to run PR code and use secrets → split it
Think "build the fork's PR, then post a comment or preview link". Split it into two workflows:
- A
pull_requestworkflow that builds and tests the untrusted code with no secrets, then uploads a small artifact. - A
workflow_runworkflow that runs after it, with the permissions it needs, and reads that artifact as data only.
name: PR build on: pull_request permissions: contents: read jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - run: npm ci - run: npm run build - run: echo "${{ github.event.pull_request.number }}" > pr-number.txt - uses: actions/upload-artifact@v4 with: name: pr-result path: pr-number.txt name: PR comment on: workflow_run: workflows: ["PR build"] types: [completed] permissions: pull-requests: write actions: read jobs: comment: if: github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest steps: - uses: actions/download-artifact@v4 with: name: pr-result run-id: ${{ github.event.workflow_run.id }} github-token: ${{ secrets.GITHUB_TOKEN }} # The artifact came from a fork. Read it as data, never run it. - name: Comment on the PR env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_REPO: ${{ github.repository }} run: | PR=$(head -c 10 pr-number.txt) if ! [[ "$PR" =~ ^[0-9]+$ ]]; then echo "bad PR number"; exit 1; fi gh pr comment "$PR" --body "Build passed ✅" The number check isn't paranoia. The fork controls what ends up in that artifact, so the privileged workflow validates it before using it. GitHub's docs are blunt about this: a workflow_run job that fetches and runs fork code has exactly the same hole as a bad pull_request_target job. Splitting only helps if the second half never executes anything from the first.
One more flag to grep for
Since v7, actions/checkout refuses to check out fork PR refs in these privileged workflows unless you set allow-unsafe-pr-checkout: true. The name is meant to stand out in code review. If you find it in your repo, someone either confirmed that code is never executed, or turned the protection off to make a red build go green. Find out which.
Your checklist before December 2
- Run the grep (or the script) on every public repo you maintain.
- Move plain CI to
pull_requestwithcontents: read. - Split anything that runs PR code and needs secrets.
- For the few workflows that truly need the trigger, add an event policy targeted at those files only.
- Check any self-hosted runners those jobs use. GitHub's guidance is to keep them isolated from internal resources and ephemeral.
GitHub has already moved this date once, so keep an eye on the changelog. Don't plan around it moving again, though. Most of these fixes take minutes, and the switch-to-pull_request case makes your CI safer even if nothing gets blocked.
If you're building with AI agents that open PRs on your repos, this is worth a second look too. More of that kind of workflow on the JavaScript Mastery YouTube channel.
Sources: GitHub changelog: pull_request_target blocked by default December 2 · Securely using pull_request_target (GitHub Docs) · Workflow execution protections GA (GitHub changelog, Sep 17)


