feat(cli): also honor GH_TOKEN, preferring it over GITHUB_TOKEN#488
Conversation
Review follow-up: accept GH_TOKEN as well, with GH_TOKEN taking precedence — the gh CLI's documented ordering. GITHUB_TOKEN is ambient in GitHub Actions while GH_TOKEN is only ever set deliberately, so the explicit variable wins. Tests clear both variables up front so an ambient token on a contributor's machine cannot leak into the single-variable cases, and cover fallback and precedence. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces support for the GH_TOKEN environment variable in the CLI authentication flow, prioritizing it over GITHUB_TOKEN to align with the behavior of the GitHub CLI. The changes update the token retrieval logic to check both variables, log the active source, and expand the test suite to verify precedence and environment isolation. There are no review comments, and I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Thank you 🙏. |
Summary
Follow-up to #479: the review there suggested also accepting
GH_TOKEN, and I pushed that change to the PR branch — but a few hours after it had already been squash-merged, so it never landed. This PR carries that commit.GH_TOKENis accepted alongsideGITHUB_TOKENand takes precedence, matching the gh CLI's documented ordering. The ordering is deliberate: in GitHub ActionsGITHUB_TOKENis the ambient workflow-injected token, whileGH_TOKENis only ever set on purpose — the explicit variable should win.beforeEachso an ambientGH_TOKENon a contributor's machine can't leak into theGITHUB_TOKEN-only cases.Testing
tsc -p tsconfig.cli.json --noEmitclean; Prettier clean.🤖 Generated with Claude Code