github: direct API with token chain, ghapi.ggcmd.io proxy now opt-in#286
Merged
Conversation
All GitHub API calls used to go through a hardcoded proxy. Now gg talks straight to api.github.com and finds credentials in this order: 1. GG_GITHUB_TOKEN / GITHUB_TOKEN / GH_TOKEN env vars 2. gh auth token (if the GitHub CLI is installed and logged in, 5s cap) 3. anonymous GG_GITHUB_API_URL points gg at any GitHub API-compatible endpoint. Only the gg-scoped GG_GITHUB_TOKEN is ever sent to a custom endpoint (with a warning if it is not HTTPS) - ambient GITHUB_TOKEN/GH_TOKEN and gh CLI tokens go nowhere but api.github.com. Errors explain themselves now instead of hiding behind 'Did not find any download URL!': rate limits (429 or message) print remediation adapted to the active endpoint, 401 says the token looks stale, connect failures point at GG_GITHUB_API_URL, and a malformed URL names the env var. Failures are stashed per repo and printed after the progress bar is cleared, so concurrent executors don't eat or misattribute each other's diagnosis. ruby and the updater surface errors the same way. CI test jobs get GITHUB_TOKEN - anonymous 60 req/hr on shared runner IPs would kill the matrix. And GG_GITHUB_API_HACK=1... shh. Fixes #282, helps #272
eirikb
enabled auto-merge (squash)
July 3, 2026 14:03
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.
All GitHub API calls used to go through a hardcoded proxy. Now gg talks straight to api.github.com and finds credentials in this order:
GG_GITHUB_API_URL points gg at any GitHub API-compatible endpoint. Only the gg-scoped GG_GITHUB_TOKEN is ever sent to a custom endpoint (with a warning if it is not HTTPS) - ambient GITHUB_TOKEN/GH_TOKEN and gh CLI tokens go nowhere but api.github.com.
Errors explain themselves now instead of hiding behind 'Did not find any download URL!': rate limits (429 or message) print remediation adapted to the active endpoint, 401 says the token looks stale, connect failures point at GG_GITHUB_API_URL, and a malformed URL names the env var. Failures are stashed per repo and printed after the progress bar is cleared, so concurrent executors don't eat or misattribute each other's diagnosis. ruby and the updater surface errors the same way.
CI test jobs get GITHUB_TOKEN - anonymous 60 req/hr on shared runner IPs would kill the matrix.
And GG_GITHUB_API_HACK=1... shh.
Fixes #282, helps #272