fix: use pull_request_target for label-triggered workflows#12638
fix: use pull_request_target for label-triggered workflows#12638
Conversation
This PR switches four workflows from `pull_request` to `pull_request_target` to prevent GitHub from requiring manual approval when the `mathlib-lean-pr-testing[bot]` app triggers label events. Since the bot never lands commits on master, it is perpetually treated as a "first-time contributor" and every `pull_request` event it triggers requires approval. `pull_request_target` events always run without approval because they execute trusted code from the base branch. This is safe for all four workflows because none check out or execute code from the PR branch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Mathlib CI status (docs):
|
|
Reference manual CI status:
|
Did you (or claude) double check if PR body is safely handled and no risk of injections here? |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude audited all four workflows for injection risk under
None of the workflows check out PR code, use (Also confirmed by a separate Codex security audit.) |
|
Thanks for the extra checks |
|
Mathlib CI status (docs):
|
|
As this changes the trigger, the
|
This PR switches four lightweight workflows from
pull_requesttopull_request_targetto stop GitHub from requiring manual approval when themathlib-lean-pr-testing[bot]app triggers label events (e.g. addingbuilds-mathlib). Since the bot never lands commits on master, it isperpetually treated as a "first-time contributor" and every
pull_requestevent it triggers requires approval.
pull_request_targetevents always runwithout approval because they execute trusted code from the base branch.
This is safe for all four workflows because none check out or execute code
from the PR branch — they only read labels, PR body, and file lists from the
event payload and API:
awaiting-mathlib.yml— checks label combinationsawaiting-manual.yml— checks label combinationspr-body.yml— checks PR body formattingcheck-stdlib-flags.yml— checks if stdlib_flags.h was modified via APIAlso adds explicit
permissions: pull-requests: readto each workflow as aleast-privilege hardening measure, since
pull_request_targethas access tosecrets.
Addresses the issue reported by Sebastian:
https://lean-fro.zulipchat.com/#narrow/channel/398861-general/topic/mathlib.20pr-testing.20breakage.3F/near/575084348
🤖 Prepared with Claude Code