Skip to content

fix(ci): pass GITHUB_TOKEN to the deploy build so star count refreshes - #142

Merged
kparisa merged 1 commit into
apache:mainfrom
saie-ch:fix/github-stars-token
Oct 21, 2026
Merged

kparisa merged 1 commit into
apache:mainfrom
saie-ch:fix/github-stars-token

Conversation

@saie-ch

@saie-ch saie-ch commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Problem

The GitHub star count in the nav is baked in at build time by scripts/fetch-github-stars.mjs, run from prebuild. deploy.yml has a daily cron, so the number is meant to refresh itself once a day.

It never did. The live site shows 4.7K while apache/iggy is at 5140 (→ 5.1K). 4.7K is the script's hardcoded FALLBACK constant — the site has been shipping a placeholder, not a fetched value.

Three things combine:

  1. src/github-stars.json is gitignored, so a fresh CI checkout has no previous value for the "keep the old value" branch to use. It is fetch-or-fallback, with no middle ground.
  2. The build step was never given a token. The fetch went out anonymously against the 60/hr-per-IP limit, which shared Actions runners exhaust routinely → 403.
  3. The failure is silent — the script only console.warns, so deploys stayed green while re-baking the same wrong number every morning.

ci.yml already passed the token (line 35), which is why this went unnoticed: the one workflow wired correctly is the one that does not deploy.

Fix

Hand the same secrets.GITHUB_TOKEN already used by the publish step (deploy.yml:41, stage.yml:39) to the build step in both workflows, lifting the limit to 1000/hr:

      - name: Build Website
        run: npm run build
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

No new secret is required — GITHUB_TOKEN is auto-provisioned by Actions. Neither deploy workflow sets a permissions: block, and the read already succeeds under ci.yml's stricter contents: read. The cross-repo read works because apache/iggy is public; the auth exists only to move off the anonymous rate-limit bucket.

Also refreshes FALLBACK to 5.1K so a failed fetch ships a roughly correct number rather than a year-stale one.

Verification

$ node scripts/fetch-github-stars.mjs
GitHub stars: 5.1K

The CI build log for this PR should show GitHub stars: 5.1K rather than a GitHub stars: API returned 403 warning.

Note

The count stays 4.7K on the live site until this merges and the next main deploy runs; the daily cron keeps it current from then on. The number remains up to ~24h stale by design — that is inherent to output: "export", and removing the lag entirely would mean fetching client-side.

🤖 Generated with Claude Code

The GitHub star count in the nav is baked in at build time by
scripts/fetch-github-stars.mjs, run from prebuild. The deploy workflow
has a daily cron, so the number is meant to refresh itself once a day.
It never did: the site shipped 4.7K while apache/iggy was at 5140.

4.7K was the script's hardcoded FALLBACK. Three things combined:

  - src/github-stars.json is gitignored, so a fresh CI checkout has no
    previous value to fall back to. It is fetch-or-fallback, with no
    middle ground.
  - The build step was never given a token, so the fetch went out
    anonymously against the 60/hr-per-IP limit, which shared Actions
    runners exhaust routinely. The API answered 403.
  - The script only console.warns on failure, so deploys stayed green
    while re-baking the same wrong number every morning.

ci.yml already passed the token, which is why this went unnoticed: the
one workflow wired correctly is the one that does not deploy.

Hand the same secrets.GITHUB_TOKEN already used by the publish step to
the build step in both deploy.yml and stage.yml, lifting the limit to
1000/hr. Also refresh FALLBACK to 5.1K so a failed fetch ships a roughly
correct number rather than a year-stale one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kparisa
kparisa merged commit 90f6d58 into apache:main Oct 21, 2026
2 checks passed
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.

3 participants