Skip to content

benchcheck: add job-urls subcommand to replace inline gh api --jq#519

Merged
gdams merged 2 commits into
mainfrom
dev/mclayton/benchcheck-job-urls
Jul 10, 2026
Merged

benchcheck: add job-urls subcommand to replace inline gh api --jq#519
gdams merged 2 commits into
mainfrom
dev/mclayton/benchcheck-job-urls

Conversation

@michelle-clayton-work

@michelle-clayton-work michelle-clayton-work commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Move the benchmark workflow's job-URL lookup out of an inline
gh api ... --jq pipeline and into a tested benchcheck job-urls
subcommand.

What changed

  • New benchcheck job-urls [jobs.json] — reads the GitHub "list jobs
    for 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 the
    compare step when present. It handles the concatenated JSON pages that
    gh api --paginate produces. This is the same output the previous --jq
    program produced, and is consumed by benchcheck report -job-urls.

  • benchmark.yml — the conclude job now builds benchcheck once, then
    runs gh api ... --paginate > jobs.json (gh still handles auth and
    pagination) piped through benchcheck job-urls, replacing the inline
    --jq filter. The prebuilt binary is reused by the report step.

Why

The label/step-link extraction was an inline jq program embedded in YAML —
hard to read, hard to test, and easy to break. Moving it into benchcheck
makes it unit-testable and keeps the workflow step simple.

Testing

gofmt, go vet, and go test ./cmd/benchcheck/ all clean. New
jobs_test.go covers deep-linking to the compare step, a skipped compare
step (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.

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.
Copilot AI review requested due to automatic review settings July 8, 2026 20:35
@michelle-clayton-work michelle-clayton-work requested a review from a team as a code owner July 8, 2026 20:35

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 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.yml to build benchcheck once and use benchcheck job-urls instead of an inline --jq program.

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.

Comment thread .github/workflows/benchmark.yml Outdated
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.
@gdams gdams merged commit 1322052 into main Jul 10, 2026
15 checks passed
@gdams gdams deleted the dev/mclayton/benchcheck-job-urls branch July 10, 2026 09:24
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.

4 participants