Repository navigation
feat(report-api-budget): log each job's api-calls count in pr-review-cli and the trust-path hold - #915
Draft
kyle-sexton wants to merge 1 commit into
Draft
feat(report-api-budget): log each job's api-calls count in pr-review-cli and the trust-path hold#915kyle-sexton wants to merge 1 commit into
kyle-sexton wants to merge 1 commit into
Conversation
…cli and the trust-path hold report-api-budget now ends each named token with the hub collector's api-calls notice, `github-token=N not-modified=M graphql=K`, in the format and counting method of claude-code-plugins' log-api-budget: api_budget_emit_calls is copied verbatim, and N is one per reading the job's own requests left. A job with no reading now logs a count of 0 instead of nothing, as log-api-budget does; the test that pinned the old silence now pins the 0 line. Every pr-review-cli job already ends with the step, so its five jobs gain the notice unchanged. pr-require-checks-trust-paths had no budget step: the check now watches its Octokit client through api-budget.cjs, the fallback status step records its one request inline (it has no checkout to require from, as the review scope step), and the job ends with report-api-budget. No input, output, secret or permission changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
#937 deleted the trust-path hold ( |
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.
No related issue: closes a measurement gap found in a GITHUB_TOKEN spend reading; no issue tracks it.
Summary
The hub ranks GITHUB_TOKEN spend by each job's
api-calls github-token=Nnotice. Jobs from the pr-review-cli and pr-require-checks-trust-paths reusables log none. In claude-code-plugins' spend reading for 2026-10-29 17:58Z-18:58Z (.work/gh-monitor/trends/token-spend-2026-10-29T18.md, a local operator file, not committed), notices accounted for 2,918 of about 4,289 calls (68%). About 1,371 calls (32%) had no notice. The file names the pr-review-hosted and pr-review-security-hosted jobs (review-status, key-credit, review-subscription, security-review; 23 runs each) as "the most likely large unmeasured spender". It also lists pr-require-checks-trust-paths (34 runs) among the jobs with no notice.Fix
report-api-budgetnow writes the api-calls notice for each named token,::notice title=api-calls::github-token=N not-modified=M graphql=K, plus anapi-calls ...summary line. It uses the same format and counting method as claude-code-plugins'log-api-budget:api_budget_emit_callsis copied byte for byte, and N counts one per reading the job's own requests left. A job with no reading now logs a count of 0 instead of nothing, aslog-api-budgetdoes.pr-review-cli.yml: unchanged. All five of its jobs already end withreport-api-budgetand record one reading per job-token request, so each now logs the notice.pr-require-checks-trust-paths.ymlhad no budget step. Now:api-budget.cjs;report-api-budget(if: always(),continue-on-error: true).Verification
node --test .github/scripts/*.test.cjs: 763 pass, 0 fail.github-token=<that job's request count>;api_budget_emit_callscounts 304 and GraphQL readings separately;github-token=6;api-budget.cjswould;api-budget.bash(diffof each function body).zizmor --offlineon the four touched workflow and action files: no findings.shellcheckonapi-budget.bash: clean.shellcheckon the action's extractedrun:block reports only SC2154 for its step env variables.biome checkon the touched tests: clean.markdownlint-cli2 README.md: clean.actionlint1.7.12 locally reports only the$/"ref is missing" finding and thecache-modekey on lines it already flags onmain. The new$/step adds one more of that class.Related
pr-review-hosted.yml,pr-review-security-hosted.ymlandpr-require-checks-trust-paths.ymlto the new tag and adds the matchingrunner-policy/policy.jsonkeys.🤖 Generated with Claude Code