Repository navigation
git pullrequest: don't fail silently without a GitHub token - #39
Merged
Merged
Conversation
With neither GITHUB_TOKEN nor GH_TOKEN set, git pullrequest opened a browser tab and exited 0 without printing anything, so scripted runs pushed branches but created no PRs. It now falls back to `gh auth token`, and if there is still no token it says the PR wasn't created and prints the URL. GitHub API errors are printed instead of only under debug. Running out of piped answers on stdin now counts as "no" instead of crashing with EOFError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What changed
GITHUB_TOKENandGH_TOKENare both unset,git pullrequestnow usesgh auth token, so it creates the PR whenever the GitHub CLI is logged in.GITFEATURES_DEBUG._confirm(), which treats running out of stdin as "no" instead of crashing withEOFError.Why
A scripted run (
printf 'y\ny\n' | git pullrequest) across 17 repos pushed every branch but created no PRs and printed nothing. With no token in the environment, the code went straight towebbrowser.open_new_tab(url)and exited 0. Separately, piping answers kept crashing withEOFErrorwhenever it asked one more question than expected, for example the "Was it main?" base-branch prompt.Reviewer notes
--dry-runandCONSOLEONLYare unchanged.tests/test_pullrequest.py, and the full suite passes (77 tests).🤖 Generated with Claude Code