Skip to content

fix: use METRICS_TOKEN for cross-org repository template steps in metrics workflow - #489

Merged
ss-o merged 2 commits into
mainfrom
copilot/fix-metrics-job-failure
Jul 28, 2026
Merged

fix: use METRICS_TOKEN for cross-org repository template steps in metrics workflow#489
ss-o merged 2 commits into
mainfrom
copilot/fix-metrics-job-failure

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

PR #488 replaced the expired ORG_TOKEN with github.token, but GITHUB_TOKEN is scoped to the .github repo and cannot execute the GraphQL query organization(login: "z-shell") { repository(name: "...") } that lowlighter/metrics issues for template: repository mode — yielding "Resource not accessible by integration" on every attempt.

Changes

  • metrics.yml: For the three template: repository steps (zi, wiki, f-sy-h), replace token: ${{ github.token }} with token: ${{ secrets.METRICS_TOKEN }} and add committer_token: ${{ github.token }} so GITHUB_TOKEN (with contents: write) still handles committing the SVGs to the metrics branch.
token: ${{ secrets.METRICS_TOKEN }}        # PAT — cross-org repo read
committer_token: ${{ github.token }}       # GITHUB_TOKEN — write to metrics branch

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_TOKEN secret must be provisioned in the metrics environment: a classic PAT with public_repo scope, or a fine-grained PAT with read access to zi, wiki, and f-sy-h.

Copilot AI requested review from Copilot and removed request for Copilot July 28, 2026 22:08
Copilot AI requested review from Copilot and removed request for Copilot July 28, 2026 22:13
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
Copilot finished work on behalf of ss-o July 28, 2026 22:14
Copilot AI requested a review from ss-o July 28, 2026 22:14
@ss-o
ss-o marked this pull request as ready for review July 28, 2026 22:38
@ss-o
ss-o requested a review from a team as a code owner July 28, 2026 22:38
Copilot AI review requested due to automatic review settings July 28, 2026 22:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: repository steps (zi, wiki, f-sy-h) to use token: ${{ secrets.METRICS_TOKEN }} for cross-repository API access.
  • Add committer_token: ${{ github.token }} so commits still use the workflow-scoped GITHUB_TOKEN (with contents: write) to push to the metrics branch.

@ss-o
ss-o merged commit df26c8e into main Jul 28, 2026
6 checks passed
@ss-o
ss-o deleted the copilot/fix-metrics-job-failure branch July 28, 2026 23:07
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