Repository navigation
merge-pr.sh: land from fork checkouts, and add --explain - #505
Merged
Merged
Conversation
…d, and add --explain The script asked gh which repository the current directory belongs to. A fork checkout also has the upstream remote, so gh named the upstream and every fork checkout was refused. The repository now comes from the pull request's name, every gh call carries it, and the script fetches and pushes through the checkout's remote whose URL matches it (https or ssh, any case; origin first, or --remote), refusing only when none does. The HR_PUSH_LANDED list is compared case-insensitively now that the name is the one given. --explain runs the landing conditions read-only and prints met or UNMET for each: the pull request is open, no open PR targets its head, review threads, the bot review of the head, bot review rounds against HR_REVIEW_ROUND_CAP, other checks, the fetched head, the repository's check, and for push-landed repositories the base ancestry and the head-branch lease. It exits 0 when all are met and 1 otherwise, and lands nothing.
…es to is the named repository's Git fetches a remote's first URL and pushes to all of them, so a remote with an unrelated second URL would have landed the change in that repository too. A remote now qualifies only when all its url and pushurl values match. --explain printed the bot review rounds twice; it prints them once, and the tests count the lines and prove that --remote overrides an unmatched URL.
Owner
Author
|
@coderabbitai full review |
…in URLs A remote's configured URL is not what git fetches from or pushes to once url.<base>.insteadOf or pushInsteadOf applies, so a push URL rewritten to another repository passed the match, and an alias rewritten to the right one was refused. A remote now qualifies by git remote get-url --all and --push --all. URLs are parsed as URI or scp-style forms, so an explicit ssh or https port no longer breaks the match.
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.
merge-pr.sh asked gh which repository the current directory belongs to. A checkout of a fork also has the upstream remote, so gh answered with the upstream in every such checkout and the script refused them all.
The repository now comes from the pull request's name, and every gh call carries it. The script fetches and pushes through the remote whose URLs are that repository's (https or ssh, any case;
originfirst, or--remote), and refuses only when none is. A remote qualifies only when every URL it fetches from or pushes to matches, because git pushes to all of a remote's URLs. TheHR_PUSH_LANDEDlist is compared case-insensitively now that the name is the one typed.--explainruns the landing conditions read-only and printsmetorUNMETfor each: the PR is open, no open PR targets its head, review threads and review-body findings, the bot review of the head, bot review rounds againstHR_REVIEW_ROUND_CAP(default 6, advisory), other checks on the head, the fetched head, the repository's own check, and for push-landed repositories the base ancestry and the head-branch lease. It exits 0 only when all are met, and it lands, pushes and deletes nothing. It runs the repository's check as a landing does.Checked: tests written first (six failed); they cover a fork checkout, URL forms,
--remoteover an unmatched URL, a remote with a second URL for another repository, the case-folded push landing, and--explainmet, unmet, broken-lease and merge cases, each leaving the remote untouched.bun run checkand the skills tests pass.