Skip to content

fix(site): skip the releases lookup when no GITHUB_TOKEN is present - #52

Merged
stuffbucket merged 1 commit into
mainfrom
fix/site-releases-lookup-without-token
Sep 7, 2026
Merged

stuffbucket merged 1 commit into
mainfrom
fix/site-releases-lookup-without-token

Conversation

@stuffbucket

Copy link
Copy Markdown
Owner

Fixes the random CI failure filed as #47.

The problem

packages/maximal/site/src/pages/updates/latest.json.ts calls the GitHub
releases API at build time and authenticates only when GITHUB_TOKEN is set.
ci.yml's build step passes no environment, so the request went out anonymous.

Anonymous GitHub API is 60 requests/hour per IP, and GitHub-hosted runners
share egress IPs across every Actions customer, so the budget is usually spent
by strangers before we arrive. This was never our own usage approaching a
limit: one call per build could not reach the 1,000/hour/repo authenticated
limit. Any run could fail with an error that reads like a release problem, and
one did on #36.

The fix

Option 1 from the issue. GET returns the existing empty-body 404 — the same
"write no latest.json" outcome the module already produces when it cannot
prove an artifact — before the network, when no token is present.

This is not a relaxation of fail-closed. Where a token is supplied and a
manifest is actually deployed, fetchLatestRelease / fetchSignature /
buildUpdaterManifest behave exactly as before. And nothing deploys a manifest
from this repository: .github/workflows/ holds only ci.yml and
release.yml, and the manifest mxml.sh serves is deployed from
stuffbucket/maximal.

Option 2 (pass GITHUB_TOKEN in ci.yml) is one line, but puts a token in the
environment of a build that executes arbitrary dependency code — the opposite
of the producer-isolation stance the release pipeline is built on.

Also drops the githubHeaders docstring's reference to deploy-pages.yml,
which does not exist in this repository.

Verification

  • astro build with GITHUB_TOKEN unset: /updates/latest.json (+1ms) (file not created, response body was empty) — no file written, and the +1ms shows
    no network call was made. verify-dist.mjs passes.
  • Full container suite green (15/15 turbo tasks), including two new
    canFetchUpdaterRelease cases covering unset, empty, and whitespace-only
    tokens.

Closes #47

The latest.json route authenticated only when GITHUB_TOKEN was set, and
ci.yml's build step passes no environment, so the build-time call to
api.github.com went out anonymous. The anonymous budget is 60 requests
per hour per IP and GitHub-hosted runners share egress IPs across every
Actions customer, so the budget is usually spent by strangers before we
arrive: any CI run could fail with an error that reads like a release
problem. It cost a full re-run of an 8-minute job on #36.

Return the existing empty-body 404 before the network when no token is
present. That is not a relaxation of fail-closed -- emitting no
latest.json is what the rest of the module already does when it cannot
prove an artifact -- and nothing in this repository deploys a manifest
from here: .github/workflows/ holds only ci.yml and release.yml, and the
manifest mxml.sh serves is deployed from stuffbucket/maximal.

The alternative, passing GITHUB_TOKEN in ci.yml, would put a token in the
environment of a build that executes arbitrary dependency code, against
the producer isolation the release pipeline is built on.

Also drops the docstring's reference to deploy-pages.yml, which does not
exist in this repository.

Closes #47
@stuffbucket
stuffbucket merged commit c8bcda2 into main Sep 7, 2026
6 checks passed
@stuffbucket
stuffbucket deleted the fix/site-releases-lookup-without-token branch September 7, 2026 04:28
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.

ci: the site build calls the GitHub releases API anonymously, so CI fails at random

1 participant