ci: fix existing-PR detection for cross-fork promotion#37
Merged
Conversation
gh pr list --head does not reliably match a cross-fork head on the base repo, so a re-run fell through to gh pr create and failed with 'already exists'. Query the REST pulls head filter (user:branch) directly and gh pr edit the matched PR.
Automated PR ReviewModel: Changed files: Review result: FindingsMedium —
|
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.
Bug
The re-run of Promote to upstream failed with
a pull request for branch "…" into branch "main" already exists … Error: exit code 1. The idempotency check usedgh pr list --repo <upstream> --head <owner:branch>, which does not reliably match a cross-fork head on the base repo — soexistingcame back empty, the job fell through togh pr create, and GitHub rejected the duplicate.Fix
Query the REST pulls head filter directly (
GET /repos/{upstream}/pulls?head=user:branch&state=open), andgh pr editthe matched PR number. This correctly detects the open cross-fork PR (plmbr#386) and refreshes its title/body instead of trying to recreate it.Generated by Claude Code