Skip to content

fix: append build info to release notes instead of replacing#46

Merged
nerdCopter merged 3 commits into
masterfrom
fix/release-notes-append
Jul 2, 2026
Merged

fix: append build info to release notes instead of replacing#46
nerdCopter merged 3 commits into
masterfrom
fix/release-notes-append

Conversation

@nerdCopter

Copy link
Copy Markdown
Owner

AI Generated pull-request

Summary

  • The upload-release-assets job's "Update release notes" step ran gh release edit --notes "**Build Information:** $BUILD_INFO", which replaces the entire release body — discarding whatever description was written when the release was created.
  • Fetch the existing release body first and append the build-info footer to it instead of overwriting it.
  • Found while preparing the v1.0.1 release: this bug never surfaced for v1.0.0 because that release's workflow run failed earlier (crates.io publish conflict + a version-check bug fixed later in feat: Release version 1.0.0 - Production-ready stable release #38/acad028), so the notes-overwrite step never ran.

Test plan

  • release.yml YAML is well-formed (reviewed diff manually)
  • Verify on the actual v1.0.1 release: after CI completes, confirm the release body still contains the full description with the build-info line appended

The 'Update release notes' step in the release workflow ran
'gh release edit --notes \"**Build Information:** ...\"' which
replaced the entire release body written when the release was
created, discarding the changelog/description.

Fetch the existing release body first and append the build-info
footer to it instead of overwriting it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@nerdCopter, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bf3259a1-a251-41e7-abad-ff80f33312c9

📥 Commits

Reviewing files that changed from the base of the PR and between eb5f3a5 and eff5764.

📒 Files selected for processing (1)
  • .github/workflows/release.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/release-notes-append

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.

@nerdCopter nerdCopter marked this pull request as ready for review July 2, 2026 20:34
@nerdCopter

Copy link
Copy Markdown
Owner Author

@coderabbitai, AI generated comment

Is this a proper fix? Context: the previous "Update release notes" step ran gh release edit --notes "**Build Information:** $BUILD_INFO", which replaced the entire release body (wiping out the description written at release-creation time). This PR fetches the existing body via gh release view --json body -q .body and appends the build-info footer to it instead of overwriting it.

Please assess whether this approach is sound (e.g. quoting/escaping of $EXISTING_NOTES in the printf/gh release edit invocation, behavior if the body is empty, any edge cases with special characters or multi-line notes).

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
fd release.yml
echo "---"
cat -n .github/workflows/release.yml | sed -n '1,400p'

Length of output: 4919


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo '{"body":null}' | jq -r '.body'
echo "---"
echo '{"body":""}' | jq -r '.body'
echo "---"
which gh || true
gh --version || true

Length of output: 432


Hi @nerdCopter, this is a solid fix for the core problem, with one edge case worth patching.

What's correct:

  • Fetching the existing body first and appending, instead of overwriting, correctly solves the described bug.
  • Using printf '%s\n\n---\n**Build Information:** %s' "$EXISTING_NOTES" "$BUILD_INFO" passes both variables as arguments to the %s placeholders rather than interpolating them into the format string itself. This is the safe pattern — it avoids printf format-string injection if either value happened to contain a literal % (e.g., a changelog entry like 50% faster).
  • The $(...) command substitution is double-quoted in the --notes "$(...)" invocation, so embedded newlines in multi-line release descriptions are preserved correctly rather than being word-split/collapsed.

One real edge case: if a release has no description at all (i.e., its body is JSON null rather than an empty string), gh release view --json body -q .body returns the literal text null (this is a known jq -r quirk — null values are rendered as the 4-character string "null", confirmed locally: echo '{"body":null}' | jq -r '.body'null). That means for such a release, the final notes would read:

null

---
**Build Information:** 1.0.1 abcdef1 (2026-07-01)

I'd suggest guarding against this, e.g.:

EXISTING_NOTES=$(gh release view "${{ github.ref_name }}" --repo "${{ github.repository }}" --json body -q '.body // ""')

or equivalently after the fact:

[ "$EXISTING_NOTES" = "null" ] && EXISTING_NOTES=""

A minor cosmetic-only nit: when the existing body is genuinely empty (empty string, not null), the appended notes will start with two blank lines before ---. Not a functional bug, just slightly untidy — not worth blocking on.

Everything else (quoting, multi-line handling, special characters) looks correct as-is.

[resolve]

Address CodeRabbit feedback on PR #46: gh release view --json body -q
.body prints the literal string "null" (jq -r quirk) when a release
has no description at all, which would leak into the appended notes.
Use -q '.body // ""' to fall back to an empty string instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@nerdCopter

Copy link
Copy Markdown
Owner Author

@coderabbitai, AI generated comment

Addressed: guarded against the null-body edge case in fe57c26 by changing the jq filter to .body // "", so a release with no description won't leak the literal string null into the appended notes.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
fd release.yml
echo "---"
grep -n "EXISTING_NOTES\|body" .github/workflows/release.yml

Length of output: 534


@nerdCopter, confirmed — Line 111 now uses -q '.body // ""', which correctly defaults a null body to an empty string, preventing the literal null from leaking into the appended notes. This fully addresses the edge case. Thanks for the quick follow-up!

[resolve]

ヽ(°〇°)ノ

@nerdCopter nerdCopter merged commit 743939d into master Jul 2, 2026
9 checks passed
@nerdCopter nerdCopter deleted the fix/release-notes-append branch July 2, 2026 20:48
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