Repository navigation
bug: Fix version number and changelog - #1293
Conversation
WalkthroughThe build script was updated to only write the contents of Changes
Sequence Diagram(s)sequenceDiagram
participant BuildScript
participant FileSystem
BuildScript->>BuildScript: Check CHANGELOG_MD
alt CHANGELOG_MD not empty
BuildScript->>FileSystem: Write resources/changelog.md
end
BuildScript->>BuildScript: Check VERSION_TXT
alt VERSION_TXT not empty
BuildScript->>FileSystem: Write resources/version.txt
end
Possibly related PRs
Suggested reviewers
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
build.sh (1)
21-26: Usage text is now out-of-sync with the real argument listThe script now expects five positional params, but the help still documents only three.
Anyone following the usage hint will pass[metadata_file]as$3, shifting every later arg and causing the newCHANGELOG_MD/VERSION_TXTlogic to silently mis-behave.-echo "Usage: $0 [prod|staging] [version_tag] [metadata_file]" +echo "Usage: $0 [prod|staging] [version_tag] [version_txt] [changelog_md] [metadata_file]"Please update both usage lines (here and below) and the accompanying comments so they reflect the current contract.
A mismatched interface is a hard-to-trace production foot-gun.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
build.sh(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: andrewNiziolek
PR: openfrontio/OpenFrontIO#1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: 🏗️ Build
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Deploy to openfront.dev
| if [ -n "$CHANGELOG_MD" ]; then | ||
| echo "$CHANGELOG_MD" > resources/changelog.md | ||
| fi | ||
| if [ -n "$VERSION_TXT" ]; then | ||
| echo "$VERSION_TXT" > resources/version.txt | ||
| fi |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
echo blindly writes the literal string – is that really what you want?
Right now the code treats $CHANGELOG_MD / $VERSION_TXT as content, not file paths.
If the caller actually passes a path (very common in CI), the file will end up containing a single line like /tmp/changelog.md.
Consider accepting file paths and copying them, which scales better for long multi-line text:
-if [ -n "$CHANGELOG_MD" ]; then
- echo "$CHANGELOG_MD" > resources/changelog.md
-fi
-if [ -n "$VERSION_TXT" ]; then
- echo "$VERSION_TXT" > resources/version.txt
-fi
+if [ -n "$CHANGELOG_MD" ] && [ -f "$CHANGELOG_MD" ]; then
+ cp "$CHANGELOG_MD" resources/changelog.md
+fi
+if [ -n "$VERSION_TXT" ] && [ -f "$VERSION_TXT" ]; then
+ cp "$VERSION_TXT" resources/version.txt
+fiThis avoids accidental clobbering and makes intent unambiguous.
If the current behaviour (inline text) is desired, please add a short comment to state that, so future readers are not caught off-guard.
🏁 Script executed:
#!/bin/bash
set -e
# Locate build.sh
file=$(fd -t f build.sh | head -n1)
echo "Found build script at: $file"
# Show top of build.sh for context
echo "====== build.sh (1-150) ======"
sed -n '1,150p' "$file"
echo
echo "====== Lines around CHANGELOG_MD ======"
rg -nC3 'CHANGELOG_MD' "$file"
echo
echo "====== Lines around VERSION_TXT ======"
rg -nC3 'VERSION_TXT' "$file"Length of output: 4259
Update build.sh to support both file paths and inline text for CHANGELOG_MD & VERSION_TXT
To avoid writing a literal filename when a path is passed, detect if the variable points to a real file—otherwise treat it as inline text.
Locations to update:
- build.sh, around lines 77–82
Apply this diff:
- if [ -n "$CHANGELOG_MD" ]; then
- echo "$CHANGELOG_MD" > resources/changelog.md
- fi
+ if [ -n "$CHANGELOG_MD" ]; then
+ if [ -f "$CHANGELOG_MD" ]; then
+ cp "$CHANGELOG_MD" resources/changelog.md
+ else
+ printf '%s\n' "$CHANGELOG_MD" > resources/changelog.md
+ fi
+ fi
- if [ -n "$VERSION_TXT" ]; then
- echo "$VERSION_TXT" > resources/version.txt
- fi
+ if [ -n "$VERSION_TXT" ]; then
+ if [ -f "$VERSION_TXT" ]; then
+ cp "$VERSION_TXT" resources/version.txt
+ else
+ printf '%s\n' "$VERSION_TXT" > resources/version.txt
+ fi
+ fiThis makes intent clear and handles both long multi-line files or short inline values.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if [ -n "$CHANGELOG_MD" ]; then | |
| echo "$CHANGELOG_MD" > resources/changelog.md | |
| fi | |
| if [ -n "$VERSION_TXT" ]; then | |
| echo "$VERSION_TXT" > resources/version.txt | |
| fi | |
| if [ -n "$CHANGELOG_MD" ]; then | |
| if [ -f "$CHANGELOG_MD" ]; then | |
| cp "$CHANGELOG_MD" resources/changelog.md | |
| else | |
| printf '%s\n' "$CHANGELOG_MD" > resources/changelog.md | |
| fi | |
| fi | |
| if [ -n "$VERSION_TXT" ]; then | |
| if [ -f "$VERSION_TXT" ]; then | |
| cp "$VERSION_TXT" resources/version.txt | |
| else | |
| printf '%s\n' "$VERSION_TXT" > resources/version.txt | |
| fi | |
| fi |
🤖 Prompt for AI Agents
In build.sh around lines 77 to 82, update the handling of CHANGELOG_MD and
VERSION_TXT to check if the variable value is a path to an existing file. If it
is a file, use its contents to write to the target file; otherwise, treat the
variable as inline text and write it directly. This ensures both file paths and
inline text are supported correctly.
## Description: Fix missing version number and changelog in branch deploys. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors
## Description: Fix missing version number and changelog in branch deploys. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors
Description:
Fix missing version number and changelog in branch deploys.
Please complete the following: