Skip to content

Handle fork PR associations in invalid-label writer - #4497

Open
mrecachinas wants to merge 1 commit into
mainfrom
copilot/fix-fork-invalid-pr-close-20260814
Open

Handle fork PR associations in invalid-label writer#4497
mrecachinas wants to merge 1 commit into
mainfrom
copilot/fix-fork-invalid-pr-close-20260814

Conversation

@mrecachinas

@mrecachinas mrecachinas commented Aug 14, 2026

Copy link
Copy Markdown
Member

Summary

This updates the trusted invalid-label writer to handle fork pull request workflow runs when GitHub does not populate the run's pull request association.

When the association is absent, the writer now searches using trusted workflow-run metadata and requires exactly one open pull request matching the expected base repository, full head repository, branch, and head SHA. Ambiguous, malformed, or stale matches continue to fail closed.

The existing workflow identity checks, pull request revalidation, label/state checks, write permissions, and scheduled reconciliation fallback remain unchanged.

Validation

  • actionlint with shellcheck
  • exact-match, ambiguous-match, and stale-SHA association cases
  • security-focused rubber-duck review of the uncommitted diff

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 512eb347-ec89-4250-8bf1-87048974b01d
@mrecachinas
mrecachinas marked this pull request as ready for review August 14, 2026 20:47
@mrecachinas
mrecachinas requested review from a team and a balanced review from Copilot August 14, 2026 20:47

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

Adds fail-closed fork PR discovery when workflow-run PR associations are absent.

Changes:

  • Validates workflow-run head metadata.
  • Finds one exact open PR by repository, branch, and SHA.
  • Revalidates the resolved PR before closing it.
Show a summary per file
File Description
.github/workflows/close-invalid-pr-writer.yml Adds secure fallback PR association and validation.

Review details

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

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

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.

2 participants