Skip to content

fix: serve version from static endpoint to avoid GitHub API rate limits#112

Merged
rhuanbarreto merged 4 commits into
mainfrom
fix/install-github-token
Mar 21, 2026
Merged

fix: serve version from static endpoint to avoid GitHub API rate limits#112
rhuanbarreto merged 4 commits into
mainfrom
fix/install-github-token

Conversation

@rhuanbarreto

@rhuanbarreto rhuanbarreto commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a static version.json endpoint at cli.archgate.dev/version.json so install scripts can resolve the latest version without hitting the GitHub API (which rate-limits unauthenticated requests to 60/hour per IP, causing 403 Forbidden errors)
  • Both install.ps1 and install.sh now query the static endpoint first, falling back to the GitHub API (with optional GITHUB_TOKEN auth) if unavailable
  • The version file is generated from package.json during the docs build and synced by .simple-release.js during releases

Changes

  • docs/scripts/generate-version-json.ts — New script that reads version from root package.json and writes docs/public/version.json
  • docs/package.json — Hooks generate-version-json.ts into the docs build pipeline
  • .simple-release.js — Syncs version.json alongside other version references during releases
  • install.ps1 — Queries cli.archgate.dev/version.json first, falls back to GitHub API with optional GITHUB_TOKEN header
  • install.sh — Same primary/fallback strategy for both curl and wget paths

Test plan

  • Run bun run docs/scripts/generate-version-json.ts — generates docs/public/version.json with correct version
  • Run install.ps1 — resolves version from static endpoint (once deployed)
  • Run install.sh (curl) — resolves version from static endpoint (once deployed)
  • Run install.sh (wget) — resolves version from static endpoint (once deployed)
  • Verify fallback: block cli.archgate.dev and confirm GitHub API fallback works
  • Verify GITHUB_TOKEN auth header is passed in fallback path

Unauthenticated requests to api.github.com are limited to 60/hour per
IP.  When GITHUB_TOKEN is set, both install.ps1 and install.sh now pass
an Authorization header, raising the limit to 5,000/hour.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 21, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: f6605a2
Status: ✅  Deploy successful!
Preview URL: https://3b7d36f8.archgate-cli.pages.dev
Branch Preview URL: https://fix-install-github-token.archgate-cli.pages.dev

View logs

Add a static `version.json` to the docs site (cli.archgate.dev) so
install scripts can resolve the latest version without hitting the
GitHub API, which rate-limits unauthenticated requests to 60/hour.

- Add `docs/scripts/generate-version-json.ts` that reads the version
  from the root `package.json` and writes `docs/public/version.json`
- Hook it into the docs build pipeline (`docs/package.json`)
- Sync `version.json` in `.simple-release.js` during releases
- Update `install.ps1` and `install.sh` to query
  `cli.archgate.dev/version.json` first, falling back to GitHub API
  (with optional GITHUB_TOKEN auth) if the static endpoint is
  unavailable
@rhuanbarreto rhuanbarreto changed the title fix: support GITHUB_TOKEN in install scripts fix: serve version from static endpoint to avoid GitHub API rate limits Mar 21, 2026
version.json is written by .simple-release.js on every version bump
and committed to the repo, so regenerating it during docs build is
redundant.
@rhuanbarreto rhuanbarreto merged commit 877c6f5 into main Mar 21, 2026
8 checks passed
@rhuanbarreto rhuanbarreto deleted the fix/install-github-token branch March 21, 2026 01:59
@github-actions github-actions Bot mentioned this pull request Mar 21, 2026
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