fix(ci): render metrics with an org-scoped token and curate Pages - #578
Merged
Conversation
The first four metrics steps passed GITHUB_TOKEN, which lowlighter/metrics rejects because it cannot read data outside the current repository. The action reported "Token validity | (could not verify)", consumed zero API requests, and still exited successfully, so the organization summary embedded in the wiki rendered "NaN members" and zeroed repository totals while the three steps already using METRICS_TOKEN rendered real figures. Pass METRICS_TOKEN to every step and keep GITHUB_TOKEN as committer_token. Set plugins_errors_fatal so a data-fetch failure fails the run instead of silently publishing placeholder output. Drop the stargazers worldmap step: GOOGLE_MAP_TOKEN is defined in neither repository nor organization secrets, so it only ever rendered "Google Maps API token is not set". Pages published the entire repository from main via path: ".", which exposed runbooks, decisions and lint configuration while omitting the generated SVGs entirely. Stage a curated set instead: profile imagery from main plus metrics assets from the metrics branch, filtered to images, with a generated index. Trigger on completion of the asset-producing workflows so new renders reach Pages without waiting for an unrelated push.
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The organization summary embedded at https://wiki.zshell.dev/docs#summary rendered
NaN membersand zeroed repository totals. The cause was the token, not CIpermissions: the workflow ran green on every schedule.
lowlighter/metricsrejectsGITHUB_TOKENbecause it fetches data outside thecurrent repository, detecting it by the absence of an
x-oauth-scopesheader.Four of the seven steps passed
${{ github.token }}. Evidence from run33300567276 (conclusion: success):
metrics.svgrepositories_metrics.svgworldmap.svgfollowup.svg*_followup.svgStep 1 fetched nothing and still exited
Successbecauseplugins_errors_fatalwas unset.
base/index.mjsassigns{totalCount: NaN}when the org field queryfails, which is the
NaN membersstring. The three steps already usingMETRICS_TOKENrendered real figures throughout, isolating the token as thevariable.
Rendered text of the two images the wiki embeds, before this change:
metrics.svg:Joined GitHub 4 years ago ... NaN members ... Verifiedrepositories_metrics.svg:90 Repositories, 0 Releases, 0 Packages, 0 Sponsors, 0 Stargazers, 0 Forkers, 0 WatchersGround truth from the API: 4 members, 88 non-fork repositories, 2124 stars,
271 forks, 95 watchers, 100 releases.
Changes
metrics.ymlMETRICS_TOKENto every step; keepGITHUB_TOKENascommitter_token.plugins_errors_fatal: yesso a failed fetch fails the run rather thanpublishing placeholder output.
GOOGLE_MAP_TOKENexists in neitherrepository nor organization secrets, so it only ever rendered
Google Maps API token is not set.static.ymlPages was serving the whole repository from
mainviapath: '.', publishingrunbooks/,decisions/,lib/and.trunk/while omitting the generatedSVGs entirely. Verified against the live site before this change:
Now stages a curated set:
profile/img/**frommainplusmetrics/**from themetricsbranch, filtered to image extensions, with a generated index. Addsworkflow_runtriggers on Z Metrics, Z Reader and Z PageSpeed Insights so newrenders reach Pages without waiting for an unrelated push to
main.Note the repository's Pages
sourcefield still readsbranch: metrics, butbuild_typeisworkflow, so that field is inert andstatic.ymlis the realpublisher.
Related
The
metricsbranch was reset separately (029e83a1->4fec54d3). It had beenbranched from
mainrather than created empty, so it carried 104 stale filesfrozen at 2026-05-18, including
gh-deploy-assets.ymlandgh-push.yml. Thosetwo were unreachable: absent from
main, unregistered ingh workflow list,and targeting a
gh-pagesbranch that does not exist. All retained SVG blobswere verified byte-identical before the push. Recovery SHA:
029e83a1.Relates to #485.
Verification
trunk check --filter=actionlint,shellcheck,prettierclean on both workflows;actionlint confirmed genuinely executing via an injected fault.
200after the branch rewrite.figures, then confirm the SVGs are reachable on Pages.