fix: use METRICS_TOKEN for cross-org repository template steps in metrics workflow - #489
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix the failing GitHub Actions job metrics
fix: use METRICS_TOKEN for cross-org repository template steps in metrics workflow
Jul 28, 2026
ss-o
approved these changes
Jul 28, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes failing lowlighter/metrics runs in .github/workflows/metrics.yml when using template: repository against other repositories in the z-shell org. It switches those template steps to use a dedicated PAT (METRICS_TOKEN) for cross-repo/org GraphQL reads while continuing to use GITHUB_TOKEN to commit generated SVGs to the metrics branch.
Changes:
- Update the three
template: repositorysteps (zi,wiki,f-sy-h) to usetoken: ${{ secrets.METRICS_TOKEN }}for cross-repository API access. - Add
committer_token: ${{ github.token }}so commits still use the workflow-scopedGITHUB_TOKEN(withcontents: write) to push to themetricsbranch.
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.
PR #488 replaced the expired
ORG_TOKENwithgithub.token, but GITHUB_TOKEN is scoped to the.githubrepo and cannot execute the GraphQL queryorganization(login: "z-shell") { repository(name: "...") }thatlowlighter/metricsissues fortemplate: repositorymode — yielding "Resource not accessible by integration" on every attempt.Changes
metrics.yml: For the threetemplate: repositorysteps (zi,wiki,f-sy-h), replacetoken: ${{ github.token }}withtoken: ${{ secrets.METRICS_TOKEN }}and addcommitter_token: ${{ github.token }}so GITHUB_TOKEN (withcontents: write) still handles committing the SVGs to themetricsbranch.The first four steps (header, repositories, stargazers, followup) continue using
github.token— their org-level queries work with GITHUB_TOKEN and are unaffected.Required action
A
METRICS_TOKENsecret must be provisioned in themetricsenvironment: a classic PAT withpublic_reposcope, or a fine-grained PAT with read access tozi,wiki, andf-sy-h.