Skip to content

fix(cli): use github reporter in github actions env#9120

Merged
ematipico merged 5 commits intomainfrom
fix/ci-github
Feb 17, 2026
Merged

fix(cli): use github reporter in github actions env#9120
ematipico merged 5 commits intomainfrom
fix/ci-github

Conversation

@ematipico
Copy link
Member

Summary

Closes #9109

Completely missed that one! Fortunately, a user filed an issue against the docs, which are our source of truth, so I think it's a valid bug.

Test Plan

I refactored the tests a bit. I moved all the help tests in their test case, with the help of AI.

I added the crate serial_test serialise all rage tests, because they use the env temporary dir. I preferred to delegate to a third-party crate as it will help us in the future with other crates that need to run serially.

As for testing this feature, I temporarily used temp_var crate to inject the environment. It worked fine. However, I had to remove it, because other tests might read the leftovers injected by the crate.

I believe a good solution is to use dependency injection via a trait, as we do with FileSystem and Console, but it's a big refactor, not something we can do now.

Docs

@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2026

🦋 Changeset detected

Latest commit: 941f0e0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ematipico ematipico requested review from a team February 17, 2026 09:43
@github-actions github-actions bot added the A-CLI Area: CLI label Feb 17, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 17, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 96 skipped benchmarks1


Comparing fix/ci-github (941f0e0) with main (4fb55cf)

Open in CodSpeed

Footnotes

  1. 96 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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

Walkthrough

Adds automatic GitHub reporter selection for biome ci by detecting the CI environment and mapping it to a CliReporter. Introduces environment_to_reporter on the Execution trait, wires that path into the CI command and finalizer/reporting flow, and centralises reporter emission via a new print_to_reporter helper. Removes workspace from FinalizePayload. Tests reorganised: a consolidated help test module was added while many individual --help tests were removed. Also adds serial_test as a dev-dependency for test serialization.

Possibly related PRs

Suggested labels

A-Tooling, A-Diagnostic

Suggested reviewers

  • arendjr
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(cli): use github reporter in github actions env' directly describes the main change: enabling the GitHub reporter when running in GitHub Actions.
Description check ✅ Passed The description relates to the changeset by explaining the fix for issue #9109, test refactoring, and dependency additions (serial_test) that align with the code changes.
Linked Issues check ✅ Passed The PR successfully implements the objective from issue #9109: detecting GitHub Actions environment and enabling the GitHub reporter via environment_to_reporter integration, whilst preserving the default reporter for human readability.
Out of Scope Changes check ✅ Passed Test refactoring (consolidating help tests, adding serial_test serialisation, removing individual help test functions) and the addition of serial_test dependency are reasonable supporting changes for the core fix and don't introduce unrelated functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ci-github

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/biome_cli/src/runner/impls/finalizers/default.rs`:
- Around line 197-226: The JSON branch currently always writes to
console_reporter_writer; change it to detect cli_reporter.is_file_report() and
route output through the file writer when set: construct or obtain the
FileReporterWriter (instead of console_reporter_writer) and use it for
reporter.write(&mut file_writer, &mut buffer) and for emitting the final JSON
string/pretty-formatted output; ensure JsonReporter, JsonReporterVisitor, and
the formatting/print steps write into the FileReporterWriter when
cli_reporter.is_file_report() is true, otherwise keep using
console_reporter_writer as before.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
crates/biome_cli/Cargo.toml (1)

91-91: Centralise serial_test in workspace dependencies for consistency. Other external dev-deps are managed in [workspace.dependencies]; adding serial_test there keeps the version pinned in one place.

Optional refactor
-serial_test          = "3.3.1"
+serial_test          = { workspace = true }

Then add to Cargo.toml under [workspace.dependencies]:

serial_test = "3.3.1"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_cli/Cargo.toml` at line 91, Move the serial_test dev-dependency
out of the crate-level Cargo.toml and centralize it in the workspace manifest:
remove the line `serial_test = "3.3.1"` from the crate's Cargo.toml and add
`serial_test = "3.3.1"` under `[workspace.dependencies]` in the workspace
Cargo.toml so the version is pinned centrally for all workspace crates; update
any crate Cargo.toml dev-deps to reference the workspace dependency if
necessary.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/biome_cli/src/runner/impls/finalizers/default.rs`:
- Around line 109-113: The ConsoleReporter instance is being constructed with
diagnostics_payload moved, but its field is defined as a reference (&'a
DiagnosticsPayload); change the construction to pass a reference (borrow)
instead of the owned value. Update the reporter creation where ConsoleReporter {
summary, diagnostics_payload, execution, ... } is built to use
&diagnostics_payload (or appropriate lifetime-bound reference) so the field type
matches ConsoleReporter::diagnostics_payload; ensure any subsequent uses still
respect the borrowed lifetime and adjust variable names if shadowing is needed.

---

Duplicate comments:
In `@crates/biome_cli/src/runner/impls/finalizers/default.rs`:
- Around line 197-226: The JSON branch currently always writes only to
console_reporter_writer so file report destinations are ignored; update the flow
in the CliReporterKind::Json / JsonPretty arm to detect
cli_reporter.is_file_report() and route output through a FileReporterWriter when
a destination is present. Concretely: keep constructing JsonReporter and
JsonReporterVisitor and calling reporter.write(...) as is, but when
cli_reporter.is_file_report() is true create a FileReporterWriter (using the
same working_directory/verbose context), write the reporter output to that
writer (and/or log to console as before), and otherwise continue using
console_reporter_writer; reference JsonReporter, JsonReporterVisitor,
reporter.write, console_reporter_writer, FileReporterWriter, and
cli_reporter.is_file_report() to locate the changes.

---

Nitpick comments:
In `@crates/biome_cli/Cargo.toml`:
- Line 91: Move the serial_test dev-dependency out of the crate-level Cargo.toml
and centralize it in the workspace manifest: remove the line `serial_test =
"3.3.1"` from the crate's Cargo.toml and add `serial_test = "3.3.1"` under
`[workspace.dependencies]` in the workspace Cargo.toml so the version is pinned
centrally for all workspace crates; update any crate Cargo.toml dev-deps to
reference the workspace dependency if necessary.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@crates/biome_cli/src/runner/impls/finalizers/default.rs`:
- Around line 211-240: The Json/JsonPretty branch always logs to
console_reporter_writer, ignoring any configured destination; change the flow in
the CliReporterKind::Json | CliReporterKind::JsonPretty arm to choose the writer
based on cli_reporter.destination (or the existing destination field) — if a
destination is present, open/create the target file writer (or use the existing
FileReporterWriter type) and pass that writer into reporter.write and subsequent
log output instead of console_reporter_writer; keep using
console_reporter_writer only when destination is None, and ensure both formatted
(JsonPretty) and raw (Json) outputs are written to the selected writer after
building root via JsonReporterVisitor and formatting when needed (symbols to
edit: JsonReporter, JsonReporterVisitor::new, reporter.write(...),
console_reporter_writer, cli_reporter.kind/CliReporterKind::JsonPretty).

@ematipico ematipico merged commit aa40fc2 into main Feb 17, 2026
32 checks passed
@ematipico ematipico deleted the fix/ci-github branch February 17, 2026 10:47
@github-actions github-actions bot mentioned this pull request Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

📎 ci command should automatically enable github reporter when appropriate

2 participants