Skip to content

github: direct API with token chain, ghapi.ggcmd.io proxy now opt-in#286

Merged
eirikb merged 1 commit into
mainfrom
feature/eirikb/github-tokens
Jul 3, 2026
Merged

github: direct API with token chain, ghapi.ggcmd.io proxy now opt-in#286
eirikb merged 1 commit into
mainfrom
feature/eirikb/github-tokens

Conversation

@eirikb

@eirikb eirikb commented Jul 3, 2026

Copy link
Copy Markdown
Owner

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

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
eirikb enabled auto-merge (squash) July 3, 2026 14:03
@eirikb
eirikb merged commit a7a4166 into main Jul 3, 2026
330 of 332 checks passed
@eirikb
eirikb deleted the feature/eirikb/github-tokens branch July 3, 2026 14:18
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.

questions about ghapi.ggcmd.io

1 participant