Skip to content

Extract website version from a file instead of sbt stdout - #43

Merged
Krever merged 1 commit into
mainfrom
fix-website-version-extraction
Aug 6, 2026
Merged

Extract website version from a file instead of sbt stdout#43
Krever merged 1 commit into
mainfrom
fix-website-version-extraction

Conversation

@Krever

@Krever Krever commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Problem

The website deploy workflow read the version by parsing sbt's stdout:

export CHATOPS4S_VERSION=$(sbt -batch -error 'print stableVersion' | head -n 1)

sbt's stdout is not machine-readable. Even with -error and --no-colors, it emits terminal erase-in-display sequences (ESC[0J) from the progress display, plus the [success] elapsed time line. --no-colors only disables color codes, not cursor/erase control codes. The result was a version string like \e[0J0.2.3, rendering on the website as [0J0.2.3.

Fix

Stop parsing stdout. A new writeStableVersion task writes the value to target/stable-version.txt, and the workflow reads that file. The warm-up sbt invocation (which only existed to absorb first-run noise) is gone too.

Verification

Ran locally against sbt 2.0.1: the file contains exactly 0.2.3 — 5 bytes, no escapes, no trailing newline (od -c confirmed). target is already gitignored and fetch-depth: 0 is already set, so dynver can still resolve previousStableVersion. scalafmtSbt produced no further changes.

Same change applied to decisions4s and workflows4s.

Summary by CodeRabbit

  • Chores
    • Improved website deployment version handling for more reliable builds.
    • The selected stable version is now recorded and displayed before the website build starts.

sbt's stdout is not machine-readable: even with -error and --no-colors it
emits terminal erase-in-display sequences (ESC[0J) from the progress
display, plus the [success] line. Parsing it with `head -n 1` produced a
version like "\e[0J0.2.3", which rendered as "[0J0.2.3" on the website.

Add a `writeStableVersion` task that writes `stableVersion` to
target/stable-version.txt and have the workflow read that file, removing
the stdout parsing and the warm-up sbt invocation it required.
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a1459759-b4a5-4f3a-aed5-29c10ef1eff1

📥 Commits

Reviewing files that changed from the base of the PR and between 921bf64 and 1eb5694.

📒 Files selected for processing (2)
  • .github/workflows/website-deploy.yml
  • build.sbt

📝 Walkthrough

Walkthrough

The build now writes the resolved stable version to target/stable-version.txt. The website deployment workflow invokes this task, reads the file, sets CHATOPS4S_VERSION, and logs the selected version.

Changes

Stable version export

Layer / File(s) Summary
Version file and deployment integration
build.sbt, .github/workflows/website-deploy.yml
build.sbt defines stableVersionFile and writeStableVersion. The deployment workflow reads the generated file and uses its value for the website build.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: scala-steward

Poem

A rabbit writes the version bright,
Into a file for build-site flight.
The workflow reads the trail,
Sets the version without fail,
And hops through deployment light.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main workflow change: reading the website version from a file instead of parsing sbt stdout.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-website-version-extraction

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Krever
Krever merged commit 2056d47 into main Aug 6, 2026
7 checks passed
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.

1 participant