Skip to content

Start benchmark history from the CI run that published a release - #494

Merged
matt-edmondson merged 2 commits into
mainfrom
fix/320-benchmark-history-trigger
Oct 30, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
fix/320-benchmark-history-trigger

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #320

Why it never ran

benchmark-history.yml triggered on release: published. The shared pipeline publishes releases with GITHUB_TOKEN, and an event caused by GITHUB_TOKEN starts no workflow run, so the trigger has never fired and the histories stopped at 5.3.x.

What changed

  • Trigger: the workflow now runs on workflow_run of CI, types: [completed], branches: [main]. That event does fire, because a push to main started the CI run, not GITHUB_TOKEN. This is the third option in the acceptance criteria. It needs no change to the shared pipeline in ktsu-dev/.github, which doesn't expose the release job's outputs to the caller.
  • New resolve job (only for a successful CI run): it reads the newest non-draft release and passes its tag on only when both of these hold:
    • it was published after the CI run started, so it came from this run and not from an earlier one. Most CI runs on main release nothing, because the version gate skips them;
    • docs/benchmarks/history.json doesn't already have that version, so a re-run of CI or an earlier dispatch can't add a second point.
  • measure now needs: resolve. It runs for that tag, or for a workflow_dispatch (with always(), because resolve is skipped on a dispatch). The "Measure the released version" step reads needs.resolve.outputs.tag instead of github.event.release.tag_name. The backfill path is unchanged.
  • CLAUDE.md records why the trigger is workflow_run, so nobody "simplifies" it back to release.

Verification

  • The YAML parses. The on: keys are now workflow_run and workflow_dispatch, and measure has needs: resolve.

  • I ran the resolve script as written, with a stubbed gh, against four cases:

    Case Output
    Release published during the run tag=v5.13.0
    Release from an earlier run no tag
    Version already in history.json (5.3.2) no tag
    No releases no tag
  • Not run locally: actionlint and a real workflow_run event. Neither can run outside Actions. The first CI run on main that releases after this merges will exercise the path.

Still needed after merge

Acceptance item 2, backfilling 5.4–5.8.x into all three histories, takes one manual dispatch of Benchmark History with the missing versions in versions. This PR doesn't do that run.


Generated by Claude Code

benchmark-history.yml triggered on `release: published`, but the shared
pipeline publishes releases with GITHUB_TOKEN, and events caused by
GITHUB_TOKEN start no workflow runs. The workflow has never run on a
release, and the histories stopped at 5.3.x.

It now triggers on `workflow_run` of CI on main. A new resolve job takes
the newest published release and passes its tag on only when it was
published after that CI run started and the history does not already have
that version. The measure job runs for that tag, or for a dispatch, as
before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW2sHrLz9iC1cJzLLZy
…runs

SonarCloud flagged the workflow_run checkouts (S7631) and the workflow-level
contents: write (S8233). The workflow now defaults to contents: read, and
only the measure job asks for write. Resolve ignores CI runs whose head
repository is a fork, since a fork's branch can also be called main. Both
checkouts drop the event-derived ref, and measure runs only when github.ref
is the default branch, which is where it pushes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW2sHrLz9iC1cJzLLZy
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 35e5d3d into main Oct 30, 2026
16 checks passed
@matt-edmondson
matt-edmondson deleted the fix/320-benchmark-history-trigger branch October 30, 2026 02:51
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.

Benchmark history never updates on release: benchmark-history.yml triggers on release: published, but releases are published with GITHUB_TOKEN

2 participants