benchcheck: add job-urls subcommand to replace inline gh api --jq#519
Merged
Conversation
The benchmark workflow's conclude job mapped matrix job labels to job URLs with an inline 'gh api --paginate --jq' pipeline. Move that parsing into a tested 'benchcheck job-urls' subcommand: it reads the jobs API response (gh still handles auth and pagination), extracts each 'bench (<label>)' job's URL, and deep-links to the compare step. The workflow now builds benchcheck once and pipes the jobs JSON through it.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the benchmark workflow’s “job URL lookup” logic by moving it out of an inline gh api ... --jq pipeline in the GitHub Actions workflow and into a dedicated, unit-tested benchcheck job-urls subcommand. This keeps the workflow simpler and makes the label/URL extraction logic testable and easier to maintain within the Go codebase.
Changes:
- Added a new
benchcheck job-urls [jobs.json]subcommand that parses one or more concatenated GitHub “list jobs for a workflow run” JSON pages and emits<label>\t<url>TSV lines, deep-linking to the first non-skipped “compare” step when present. - Added unit tests covering compare-step deep linking, skipped compare steps, ignoring non-benchmark jobs, multi-page paginated input, and empty jobs lists.
- Updated
.github/workflows/benchmark.ymlto buildbenchcheckonce and usebenchcheck job-urlsinstead of an inline--jqprogram.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/benchcheck/main.go | Registers the new job-urls subcommand and documents it in the command list. |
| cmd/benchcheck/jobs.go | Implements benchcheck job-urls parsing and TSV generation, including compare-step deep links and paginated input handling. |
| cmd/benchcheck/jobs_test.go | Adds unit coverage for the new jobs parsing and URL deep-link behavior. |
| .github/workflows/benchmark.yml | Simplifies the workflow by replacing inline jq with the tested benchcheck job-urls command and reusing a single built binary. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dagood
reviewed
Jul 8, 2026
Per review, move the gh api call into the job-urls subcommand (-repo/-id flags; gh still handles auth and pagination). The workflow step no longer needs an intermediate jobs.json file or the double '|| true' exit-code handling, so a gh/API failure now surfaces as a step failure instead of silently producing a partial job_urls.tsv. A file/stdin mode is retained for testing.
dagood
approved these changes
Jul 10, 2026
gdams
approved these changes
Jul 10, 2026
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.
Move the benchmark workflow's job-URL lookup out of an inline
gh api ... --jqpipeline and into a testedbenchcheck job-urlssubcommand.
What changed
New
benchcheck job-urls [jobs.json]— reads the GitHub "list jobsfor a workflow run" API response (from a file or stdin), and writes a TSV
mapping each
bench (<label>)matrix job to its job URL, deep-linked to thecompare step when present. It handles the concatenated JSON pages that
gh api --paginateproduces. This is the same output the previous--jqprogram produced, and is consumed by
benchcheck report -job-urls.benchmark.yml— theconcludejob now buildsbenchcheckonce, thenruns
gh api ... --paginate > jobs.json(gh still handles auth andpagination) piped through
benchcheck job-urls, replacing the inline--jqfilter. The prebuilt binary is reused by the report step.Why
The label/step-link extraction was an inline
jqprogram embedded in YAML —hard to read, hard to test, and easy to break. Moving it into
benchcheckmakes it unit-testable and keeps the workflow step simple.
Testing
gofmt,go vet, andgo test ./cmd/benchcheck/all clean. Newjobs_test.gocovers deep-linking to the compare step, a skipped comparestep (no deep link), ignoring non-benchmark jobs, multi-page (
--paginate)input, and empty input. Also smoke-tested the built binary against a sample
jobs response via stdin.