Skip to content

Migrate pull request automation away from pull_request_target - #22321

Open
mrecachinas wants to merge 3 commits into
mainfrom
copilot/prt-migration-20260811-codeql
Open

Migrate pull request automation away from pull_request_target#22321
mrecachinas wants to merge 3 commits into
mainfrom
copilot/prt-migration-20260811-codeql

Conversation

@mrecachinas

@mrecachinas mrecachinas commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

Migrate the repository's remaining pull request automation away from pull_request_target without executing pull request code in a privileged context.

  • Run the change-note check on pull_request with read-only permissions.
  • Reconcile labels from the trusted default branch every 15 minutes for recently updated PRs.
  • Reconcile a stable shard of all open PRs hourly so missed runs recover within six hours.
  • Support manual reconciliation of one PR, restricted to the default branch.
  • Re-fetch and validate each PR's open state, base repository, head repository, and head SHA before labeling.

The labeler only checks out .github/labeler.yml from the default branch. It treats pull request numbers, head SHAs, and changed filenames as data and never checks out or executes pull request code. This covers unapproved fork PRs and conflicted PRs, neither of which can reliably dispatch a pull_request workflow.

Validation

  • actionlint on both modified workflows (excluding the pre-existing actions/labeler@v4 Node runtime warning)
  • YAML parsing and git diff --check
  • Live candidate generation against all 446 open PRs
  • Validation of same-repository and fork PRs
  • Confirmed stale head SHAs are rejected

This is workflow-only infrastructure, so the PR has the no-change-note-required label.

mrecachinas and others added 2 commits August 11, 2026 10:57
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mrecachinas
mrecachinas marked this pull request as ready for review August 12, 2026 13:37
@mrecachinas
mrecachinas requested a review from a team as a code owner August 12, 2026 13:37
Copilot AI balanced review requested due to automatic review settings August 12, 2026 13:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates PR automation from pull_request_target to lower-privilege workflows with a validated privileged labeling stage.

Changes:

  • Splits label detection and application across pull_request and workflow_run.
  • Validates PR identity and head commit before labeling.
  • Runs change-note checks with read-only permissions.
Show a summary per file
File Description
.github/workflows/labeler.yml Adds the unprivileged labeling trigger.
.github/workflows/labeler-apply.yml Validates and labels the associated PR.
.github/workflows/check-change-note.yml Migrates change-note checks to pull_request.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread .github/workflows/labeler.yml Outdated
@mrecachinas mrecachinas added the no-change-note-required This PR does not need a change note label Aug 12, 2026
Replace the fork-approval-gated dispatcher with frequent trusted scheduled reconciliation and stable hourly recovery shards. Revalidate each open pull request and head SHA immediately before applying labels without checking out pull request code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 512eb347-ec89-4250-8bf1-87048974b01d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants