ci: verify the build before committing refreshed data

The CI failure on the merge commit was the one-time bootstrap ordering
problem: `go run . -build` ran before any data/metadata.json existed. The
nightly updater has since committed one, so the tree builds — but that
commit was pushed with GITHUB_TOKEN, which by design does not re-trigger
workflows, so CI never re-ran and main's status stayed red.

That exposes a standing gap rather than a one-off: every nightly refresh
commits the exact data the build consumes, and none of those commits run
CI. A refresh that broke the build would first be noticed by Cloudflare
at deploy time.

Run `go run . -build` in the update workflow between the fetch and the
commit, so data that does not build is never committed. Add
workflow_dispatch to CI so a bot-pushed commit can still be verified on
demand.
This commit is contained in:
tiennm99 committed 2026-09-16 22:30:58 +07:00
1 parent 8eeda94f82
commit b8e606f35c
3 files changed
+25 -6

No files matched your search

+13 -6
View File
@@ -29,11 +29,18 @@ Cloudflare's build webhook, which redeploys with the new numbers.
## One-time setup
### 1. Bootstrap `data/metadata.json`
### 1. Check `data/metadata.json` is committed
The build fails without it, so generate it before connecting Cloudflare. Either
trigger the **Update rankings** workflow manually (Actions tab →
*Update rankings* → *Run workflow*), or run the updater locally and commit:
The build reads it and fails without it. It is committed on `main`, kept fresh
by the nightly **Update rankings** workflow — so this is normally just a
sanity check:
```bash
go run . -build # should print "built dist: N entries, data fetched ..."
```
If it is ever missing (a fresh fork, say), regenerate it by triggering
**Update rankings** manually from the Actions tab, or locally:
```bash
export GITHUB_TOKEN=ghp_your_token_here
@@ -85,8 +92,8 @@ are copied into `dist/` as-is and use Cloudflare's defaults.
## Troubleshooting
**Build fails with "data/metadata.json not found"** — the bootstrap in step 1
has not been committed yet.
**Build fails with "data/metadata.json not found"** — step 1 has not been
committed yet. Trigger *Update rankings* to produce it.
**A newly added tool is missing from the site** — expected between merging the
`agents.yml` entry and the next update run. The build logs a warning and omits