智能体
dev.to ·
@Unite and Create For Life
GitHub pull_request_target 变更在千星仓库中破坏了什么
作者用自建检查工具 prt-check 扫描 GitHub 上 1000 个星标最多的仓库,发现 269 个(26.9%)至少有一个工作流使用 pull_request_target,涉及 540 个工作流文件。文中列出两项带日期的 GitHub 变更:自 2026-07-20 起 actions/checkout 默认拒绝在 pull_request_target 与 workflow_run 中检出 fork PR 代码,除非显式选择加入;自 2026-11-02 起 GitHub 将默认封禁未配置 Actions 策略的公开仓库使用该触发器。报告仅公布聚合数字,不点名具体仓库。
AI推荐理由 给出可核验的具体数据:扫描 GitHub 千星仓库发现 269/1000(26.9%)至少有一个工作流使用 pull_request_target,共 540 个工作流文件;并列出两项有日期的 GitHub 变更(2026-07-20 checkout 限制、2026-11-02 默认封禁)。工具由作者自建,报告仅给聚合数字、不点名仓库,方法透明度尚可。
66
正文
GitHub is changing how pull_request_target works this year. Two dated changes affect every public repository that uses the trigger, so I built a small free checker, prt-check, with my AI engineering system (HAL), and ran it over the 1,000 most-starred repositories on GitHub.
Check your own repository in one step:
- uses: actions/checkout@v4
- uses: UniteAndCreateForLife/prt-check@v1
Enter fullscreen mode
Exit fullscreen mode
Or run python prt_check.py locally (no dependencies).
The two changes: since 2026-07-20, actions/checkout refuses to check out fork pull request code in pull_request_target and workflow_run workflows unless you opt in (changelog). From 2026-11-02, GitHub blocks pull_request_target on public repositories that have no Actions policy allowing it (changelog).
Scanned 2026-09-26, 37 days before GitHub's default block on 2026-11-02, with prt-check. Aggregate numbers only: this report names no repository.
The numbers
269 of 1,000 (26.9%) run at least one workflow on pull_request_target (540 workflow files). Unless their maintainers allow the trigger in an Actions policy, those workflows stop running on 2026-11-02.
9 (0.9%) check out fork pull request code in a privileged workflow, with an actions/checkout that has the new guard and no condition that keeps forks out. Since 2026-07-20 the guard refuses those checkouts, so the steps fail for pull requests from forks. Label-gated ones fail when the label is added.
3 check out fork code in a privileged workflow with actions/checkout pinned to a version or commit from before the guard. The guard doesn't apply to them, so the fork's code is checked out where the workflow's token and secrets are. They are the most urgent to fix, and this report does not name them.
4 opted in with allow-unsafe-pr-checkout: true: a deliberate decision, safe only if no later step executes the fork's files.
9 fetch pull request code with git fetch ...pull/... or gh pr checkout in a privileged workflow. That path bypasses the new guard in actions/checkout.
8 run an AI or review action on pull_request_target. Those reviewers go quiet on 2026-11-02 unless the trigger is allowed.
What runs on pull_request_target today
The actions used most often in these workflows, by the number of repositories that use them there:
Action
Repositories
actions/github-script
125
actions/labeler
50
actions/create-github-app-token
25
actions/setup-node
22
actions/setup-python
16
amannn/action-semantic-pull-request
13
eps1lon/actions-label-merge-conflict
12
actions/upload-artifact
12
contributor-assistant/github-action
10
step-security/harden-runner
6
dorny/paths-filter
6
actions/download-artifact
6
AI and review actions on the trigger:
Action
Repositories
anthropics/claude-code-action
5
presubmit/ai-reviewer
1
anthropics/claude-code-base-action
1
openai/codex-action
1
Method
Selection: the 1,000 most-starred public, non-fork, non-archived repositories, from GitHub's repository search on 2026-09-26. 809 of them have workflow files (9,328 files in total). 0 could not be read.
Only .github/workflows/*.yml and *.yaml on the default branch were read, through the GitHub API and raw.githubusercontent.com. No workflow was run, and nothing was written anywhere.
Each file went through prt_check.py, which reads YAML line by line. README lists the codes, and the tests show the layouts it understands.
Every repository behind the second and third numbers was reviewed by hand, and the checker was corrected wherever the review found it wrong: job conditions, Dependabot-only jobs, workflow_run upstreams and branch filters, and commit pins resolved to exact actions/checkout releases.
Actions policies (repository, organization or enterprise) are not visible from outside, so some of these repositories may already allow pull_request_target and keep running it after 2026-11-02. The numbers count workflows that depend on the trigger, not workflows that will certainly stop.
What to do
Run prt-check on your repository (Action or one command), then follow the three fixes in the README: switch to pull_request, split into pull_request + workflow_run, or keep the trigger deliberately with an Actions policy.
Source code, tests and the full method: https://github.com/UniteAndCreateForLife/prt-check. If you hit a false positive, open an issue and I'll fix it.