Skip to content

feat: expose the run id as a GitHub Actions step output - #551

Merged
moha-bekh merged 6 commits into
mainfrom
cod-3661-expose-the-run-id-as-an-output-of-the-runner-and-the-github
Oct 1, 2026
Merged

moha-bekh merged 6 commits into
mainfrom
cod-3661-expose-the-run-id-as-an-output-of-the-runner-and-the-github

Conversation

@moha-bekh

Copy link
Copy Markdown
Member

After a successful upload on GitHub Actions, write the CodSpeed run id to $GITHUB_OUTPUT as run-id, so later workflow steps can read the run back instead of guessing it from the commit and branch.

All uploads of a workflow run land in the same CodSpeed run, so the id of the last upload is the run id. Failing to write the output only logs a warning.

The action will expose it as a run-id output once this is released.

Closes COD-3661

A workflow step running after the benchmarks had no way to know which
CodSpeed run the results were uploaded to. After a successful upload on
GitHub Actions, write it to `$GITHUB_OUTPUT` as `run-id`.

All uploads of a workflow run share the same CodSpeed run, so the id of
the last upload is the run id. A failure to write the output only warns.

Closes COD-3661
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codspeed

codspeed Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 33 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing cod-3661-expose-the-run-id-as-an-output-of-the-runner-and-the-github (d803d08) with main (080ed5f)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Writing to `$GITHUB_OUTPUT` on every upload would add a `run-id` output
to any user `run:` step invoking the runner. Gate it behind
`--export-run-id` / `CODSPEED_EXPORT_RUN_ID`, set by the CodSpeed action.

Refs COD-3661
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@moha-bekh
moha-bekh marked this pull request as ready for review September 28, 2026 12:55
@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Adds run ID export to GitHub Actions step outputs.

The PR appears safe to merge; no new actionable failure or outstanding previous finding was established.

Summary

The PR exports the last successful upload’s CodSpeed run ID as a GitHub Actions run-id step output. It removes the opt-in CLI setting and makes export automatic for GitHub Actions while leaving other providers with a no-op implementation.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Upload completed run parts] --> B[Last upload result]
  B --> C[Export run ID]
  C -->|GitHub Actions| D[Append run-id to GITHUB_OUTPUT]
  C -->|Other providers| E[No-op]
  D -->|Write fails| F[Log warning]
Loading

Reviews (5) · Last reviewed commit: "feat: always export the run id on GitHub..."

Comment thread src/run_environment/github_actions/provider.rs Outdated
Comment thread src/run_environment/github_actions/provider.rs
Now that the export is opt-in, a missing `$GITHUB_OUTPUT` means the
caller asked for a `run-id` output that will never be written. Surface
it as a warning instead of silently skipping.

Refs COD-3661
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@GuillaumeLagrange GuillaumeLagrange 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.

OLGTM

Comment thread src/run_environment/provider.rs
@GuillaumeLagrange

Copy link
Copy Markdown
Contributor

No need for three commits though, squash and merge

Providers without a native step output now print `{"run_id": "..."}` on
stdout when the run id export is enabled, instead of silently doing nothing.

Refs COD-3661
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/run_environment/provider.rs Outdated
moha-bekh and others added 2 commits September 29, 2026 08:50
Use `log_json!` instead of `println!`, the channel already used for other
machine-readable output. Locally the JSON still goes to stdout while logs
stay on stderr; the GitLab, Buildkite and CircleCI loggers drop JSON events,
so the run id is no longer printed there.

Refs COD-3661
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the hidden `--export-run-id` flag and its `CODSPEED_EXPORT_RUN_ID`
env var: the runner now always writes the `run-id` step output after
uploading on GitHub Actions. Other providers no longer print the run id
as JSON, since without the gate it would show up on every run.

Refs COD-3661
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@GuillaumeLagrange GuillaumeLagrange 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.

lgtm once tested with the action you can merge

@moha-bekh
moha-bekh merged commit fabf8e4 into main Oct 1, 2026
57 checks passed
@moha-bekh
moha-bekh deleted the cod-3661-expose-the-run-id-as-an-output-of-the-runner-and-the-github branch October 1, 2026 08:59
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.

2 participants