Skip to content

Migrate pull request automation away from pull_request_target - #4449

Open
mrecachinas wants to merge 2 commits into
mainfrom
copilot/prt-migration-20260811-copilot-cli
Open

Migrate pull request automation away from pull_request_target#4449
mrecachinas wants to merge 2 commits into
mainfrom
copilot/prt-migration-20260811-copilot-cli

Conversation

@mrecachinas

@mrecachinas mrecachinas commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

Migrate invalid-label automation away from pull_request_target while preserving issue and pull request closure behavior.

  • Close invalid issues directly with an issue-scoped write token.
  • Use a no-permission pull_request signal for prompt handling of mergeable PRs.
  • Run privileged PR closure from the trusted default-branch workflow_run workflow without trusting the signal's conclusion.
  • Validate the triggering workflow identity, repository, associated PR, head repository, and exact head SHA before closing.
  • Reconcile open invalid-labeled PRs on a trusted schedule (and manual dispatch) so conflicted PRs and missed signals are still closed.

Validation

  • actionlint on both modified workflows
  • YAML parsing and structural permission/trigger assertions
  • Mocked writer tests covering failed signal conclusions, trusted head matches, stale head rejection, untrusted workflow rejection, and reconciliation filtering
  • Post-push CodeQL, Actions analysis, and service catalog checks

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

This comment was marked as spam.

farrellpatricia389-svg

This comment was marked as spam.

@mrecachinas
mrecachinas marked this pull request as ready for review August 12, 2026 13:37
@mrecachinas
mrecachinas requested review from a team and a balanced review from Copilot 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 invalid-label automation away from pull_request_target by separating low-privilege PR detection from privileged closure.

Changes:

  • Retains direct invalid-issue closure with scoped permissions.
  • Adds a low-privilege PR label signal.
  • Adds a workflow_run writer that revalidates and closes invalid PRs.
Show a summary per file
File Description
.github/workflows/close-invalid.yml Splits issue closure from PR signaling.
.github/workflows/close-invalid-pr-writer.yml Adds privileged follow-up PR validation and closure.

Review details

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

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

Comment thread .github/workflows/close-invalid.yml
Comment thread .github/workflows/close-invalid-pr-writer.yml
Comment thread .github/workflows/close-invalid-pr-writer.yml Outdated
Bind privileged closure to the trusted workflow identity and exact PR head, and reconcile invalid conflicted PRs from the default branch.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants