Commit Graph
1 Commits
Author SHA1 Message Date
Andrew Vavilchenko 012bc5ab58 fix: add GITHUB_TOKEN / GH_TOKEN support to GitHub API requests (#2995)
* fix: add GITHUB_TOKEN support to GitHub API requests to avoid 403 rate-limiting

Unauthenticated GitHub API calls are capped at 60 requests/hour, causing 403s under typical usage (BackendManager scans multiple repos on startup). Add a github_api_headers() helper that reads GITHUB_TOKEN / GH_TOKEN from the environment and injects an Authorization header, raising the limit to 5 000 req/h.

Applied in fetch_latest_github_tag(), resolve_asset_wildcard(), and recipe_import.cpp — the three code paths that issue HTTP GET to api.github.com.

* fix: address PR #2995 review — CI ON, retry on 401/404, fix empty-token test

- CMakeLists.txt: switch GithubApiTest to CI ON per project testing guide
- github_api.h: retry without auth on 401/403/404 (scoped GITHUB_TOKEN
  can surface as any of these on unrelated repos)
- test_github_api.cpp: set_env() now sets empty strings on POSIX too;
  test case 4 sets GITHUB_TOKEN="" explicitly to cover the empty-string
  fallback branch instead of unsetting it
2026-08-10 16:03:38 +00:00