Skip to content

git pullrequest: don't fail silently without a GitHub token - #39

Merged
martyzz1 merged 1 commit into
masterfrom
claude/git-pullrequest-issue-06a4fb
Nov 7, 2026
Merged

martyzz1 merged 1 commit into
masterfrom
claude/git-pullrequest-issue-06a4fb

Conversation

@martyzz1

@martyzz1 martyzz1 commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • Token fallback: when GITHUB_TOKEN and GH_TOKEN are both unset, git pullrequest now uses gh auth token, so it creates the PR whenever the GitHub CLI is logged in.
  • No silent fallback: if there is still no token, it says the pull request wasn't created and prints the URL, as well as opening it in the browser.
  • API errors shown: a failed GitHub API call now prints the error. Before, it only showed with GITFEATURES_DEBUG.
  • Prompts: every y/n prompt goes through a new _confirm(), which treats running out of stdin as "no" instead of crashing with EOFError.

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 to webbrowser.open_new_tab(url) and exited 0. Separately, piping answers kept crashing with EOFError whenever it asked one more question than expected, for example the "Was it main?" base-branch prompt.

Reviewer notes

  • The API error body now goes to stdout on every run, not just under debug.
  • --dry-run and CONSOLEONLY are unchanged.
  • There are four new tests in tests/test_pullrequest.py, and the full suite passes (77 tests).

🤖 Generated with Claude Code

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>
@martyzz1
martyzz1 merged commit 59d1651 into master Nov 7, 2026
12 checks passed
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.

1 participant