Repository navigation
Prevent push coverage from matching fork pull requests - #33
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Early candidate selection can accept partially invalid GitHub CLI output instead of failing safely.
Review effort: Balanced
Findings: 1
What changed in this PR
Prevents push coverage from being attributed to same-named branches in fork repositories.
Changes:
- Filters PR candidates by branch and head repository.
- Handles ambiguous matches with warnings.
- Adds regression tests and documentation.
| File | Description |
|---|---|
resolve_upload_context.py |
Implements structured PR selection. |
test_resolve_upload_context.py |
Adds lookup regression tests. |
README.md |
Documents ambiguous PR behavior. |
docs/workflow-strategies.md |
Updates push-workflow guidance. |
CHANGELOG.md |
Records the fixes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
jkbschmid
reviewed
Sep 30, 2026
jkbschmid
left a comment
Collaborator
There was a problem hiding this comment.
Only a few nits, looks good to me conceptually 👌
Feel free to ignore any nits that are unrelated to this PR.
jkbschmid
approved these changes
Oct 1, 2026
jkbschmid
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for also addressing the nits unrelated to this PR! ❤️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Prevent coverage generated by a non-default branch push from being associated with an unrelated fork pull request whose head branch has the same name.
Background
For push-only workflows, the action discovers an open pull request using the pushed branch name:
GitHub CLI matches that name across both internal and fork head repositories. If an internal branch and a fork use the same branch name, the action could select the fork PR and attribute the internal branch's coverage to it.
v1.4.3already fixed the default-branch version of this problem by ensuring default-branch pushes never perform PR discovery. This PR fixes the remaining non-default branch path.Implementation
The lookup now requests structured pull request metadata and accepts candidates only when:
GITHUB_REPOSITORY.The resulting behavior is:
v1.4.3.The public action interface and required permissions are unchanged.
Compatibility and trade-offs
A repository branch can have multiple open pull requests when those pull requests target different base branches. A push event does not identify one of them as the intended pull request.
Previously, the action silently selected whichever result appeared first. This PR uses the default-branch target when one exists because that aligns with the current coverage comparison baseline. If the remaining candidates are still ambiguous, skipping successfully avoids both incorrect attribution and turning valid repository state into a failing required check.
A workflow using the
pull_requestevent remains the recommended option when each pull request needs an unambiguous upload.Test plan
Regression tests cover: