Move `Package Label` and `PR Review Gates` off `pull_request_target`

Merged
DS
25d ago
+46-44

This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.

Why we make these changes

GitHub blocks pull_request_target by default in public repositories from 2026-12-02. This is step 1 of the plan on #12961, which this PR does not close. Neither workflow here needs the event:

  • Package Label only reads the PR's labels. pull_request gives fork PRs a read-only token, which is enough.
  • PR Review Gates already wakes through workflow_run from PR Bots and PR Review Gates Events. That observer now also fires on PR opens, pushes, reopening, edits and label changes, so the pull_request_target trigger goes. The review-target job accepts pull_request from the observer and rejects any other direct event.

bots.yml, pr-guard.yml, protect-github-dir.yml, docs-navigation.yml and ci-duration-report.yml stay on pull_request_target under the admin event policy.

New public surface

None.

User-visible behavior

 # .github/workflows/package-label.yml
 on:
-  pull_request_target:
+  pull_request:
  • A fork PR whose runs GitHub holds for approval gets Package Label once a maintainer approves the run, as it already gets CI. Here that hold applies to first-time contributors new to GitHub.
  • A PR runs its own copy of package-label.yml.

Verification

What changes for existing users

Nothing for library users; only repository CI changes.

Deliberate scope:

  • PR Bots still wakes PR Review Gates on opens, pushes, edits and label changes, so a held fork PR keeps getting Gate: statuses until bots.yml moves.
  • An edit or label change on a closed PR now fails one more PR Review Gates run ("Requires one open PR at the observed workflow head"). The PR Bots wake-up already fails that way; the failure writes no status.
  • The #12961 policy comment drops these two workflows after merge.
PR decisions

2026-11-09 · tracking issue route · iter -

  • Decision: Filed #12961 assigned dsfaccini with pydanty:skip (immediate-work route); admin event policy is David's action outside the repo
  • Why: Manager dispatch named the route; the policy change is not a repo change
  • Source: https://github.com/pydantic/pydantic-ai/issues/12961
  • Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c

2026-11-09 · policy now, redesign plan, no moves yet · iter -

2026-11-09 · two path-scoped event policies · iter -

  • Decision: Policy 1 allows only pull_request_target for 6 PRT-only files; policy 2 allows pull_request_target, workflow_run, merge_group for pr-review-gates.yml and pr-review-checks.yml
  • Why: restrict_action_events is an allowlist, so a targeted file runs only on listed events
  • Source: https://github.com/pydantic/pydantic-ai/issues/12961#issuecomment-6749255839
  • Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c

2026-11-09 · step 1 scope · iter -

  • Decision: One small PR: Package Label to pull_request; PR Review Gates woken by pull_request in pr-review-gates-events.yml via existing workflow_run; review-target map, test_pr_gates.py, AGENTS.md. Drop the two from the #12961 policy comment only after merge. bots.yml and pr-review-checks wait for #12859 merge and the admin policy
  • Why: David's answer to the audit (manager dispatch 2026-11-09T19:47Z)
  • Source: https://github.com/pydantic/pydantic-ai/issues/12961#issuecomment-6749256306
  • Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c

2026-11-09 · pr-guard and protect-github-dir stay on pull_request_target · iter -

2026-11-09 · code-owner claim in AGENTS.md left as is · iter -

  • Decision: David enforces code-owner review in the ruleset (admin change) instead of editing .github/workflows/AGENTS.md
  • Why: David (manager dispatch 2026-11-09T19:47Z): make the documented control real
  • Source: https://github.com/pydantic/pydantic-ai/issues/12961
  • Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c

2026-11-09 · pre-push review 1 of 3 at ad89e3288d67d9148f893b3eaf6849eb2941ee5f · iter -

2026-11-09 · pre-push review 1 of 3 at ad89e3288d67d9148f893b3eaf6849eb2941ee5f · iter -

2026-11-09 · exempt delta ad89e3288d..8db8637e9a62ad95b2d8abc03e23ff0eefc351d4 · iter -

  • Decision: No re-review: package-label.yml change is comment-only; AGENTS.md change is a rewrap with an identical word sequence
  • Why: Rubric rungs (API, behavior, docs meaning, tests) untouched: no YAML key, test or instruction wording changed; verified by comment-only diff and word-sequence diff. Chains from reviewed ad89e3288d
  • Source: https://github.com/pydantic/pydantic-ai/tree/chore/pull-request-target-audit
  • Session: cff95ae3-d1dc-4cd7-ac42-fd30b183471c

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
  • PR title is fit for the release changelog.