Skip to content

ci: add commit messages to generated release notes - #368

Merged
Abhijeet Prasad (AbhiPrasad) merged 1 commit into
mainfrom
release-notes-commit-log
Sep 11, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 1 commit into
mainfrom
release-notes-commit-log

Conversation

@starfolkai

@starfolkai starfolkai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the commit messages between the previous stable release and the one being released into the auto-generated GitHub release notes.

Requested by Abhijeet Prasad (@AbhiPrasad) — include commit messages (current tag → last tag) in release notes.

What changed

In the announce job of .github/workflows/release.yml:

  • Checkout now fetches full history + tags (fetch-depth: 0, fetch-tags: true).
  • Before gh release create, a Commits section is appended to cargo-dist's announcement_github_body:
    • Resolves the previous stable tag via git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-version:refname (canary-* and other non-release tags are ignored).
    • Lists non-merge commits in previous_tag..<release commit> as - <subject> (<short sha>).
    • Adds a **Full Changelog** compare link.
    • Falls back to full history (no compare link) for the first release.

Example output

The section appended to the release notes for v0.19.3 (below cargo-dist's existing body):

## Commits

- chore: release v0.19.3 (#367) (71134cf)
- Bump Rust SDK and daemon dependencies (#366) (b5be3e8)
- feat: Go eval support (#305) (b724347)
- test: run full unit suite in CI (#364) (6fee421)
- bump bt daemon dependency (#365) (071e1d1)
- chore: Fix security alerts (#359) (6030fe1)
- Use public app URLs for generated links (#363) (fa4e76c)
- SDK-223 Honor JSON output for project commands (#361) (123d914)
- SDK-325 Fetch Markdown documentation pages (#360) (64460f8)

**Full Changelog**: https://github.com/braintrustdata/bt/compare/v0.19.2...v0.19.3

Validation

Ran the exact shell logic against the real repo for v0.19.3; it resolved v0.19.2 as the previous tag and rendered a correct Commits section + compare link. Workflow YAML validated.

🤖 Generated with Claude Code

Created by Abhijeet Prasad (@AbhiPrasad)

Slack thread

Append a "Commits" section (previous stable tag -> this release) to the
cargo-dist announcement body before creating the GitHub release. Fetches
full history/tags in the announce job, resolves the previous stable
v<major>.<minor>.<patch> tag (ignoring canary-* tags), lists non-merge
commits, and adds a Full Changelog compare link. Handles the first-release
case with no previous tag.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ffd5ea53d3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".

| grep -vFx "$RELEASE_TAG" | head -n1 || true)"

if [ -n "$previous_tag" ]; then
commit_range="${previous_tag}..${RELEASE_COMMIT}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge End the commit range at the released tag

When this workflow is manually dispatched from a branch while inputs.tag identifies a different commit, the plan checks out that tag but RELEASE_COMMIT remains the dispatch ref's github.sha. This range therefore lists commits through the branch tip rather than commits contained in the release, while the notes and comparison link label them as belonging to RELEASE_TAG; resolve the endpoint from the tag or propagate the plan checkout SHA.

Useful? React with 👍 / 👎.

Comment on lines +421 to +422
previous_tag="$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-version:refname \
| grep -vFx "$RELEASE_TAG" | head -n1 || true)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Select a previous tag from the release ancestry

When manually publishing or recreating an older/backport release after a higher stable version exists, sorting every tag by version and merely excluding the current tag selects that newer release as previous_tag. The resulting newer..older log is empty or contains only divergent commits, and the changelog link compares unrelated releases; restrict candidates to tags merged into the release commit and select the nearest preceding one.

Useful? React with 👍 / 👎.

@github-actions

Copy link
Copy Markdown
Contributor

Latest downloadable build artifacts for this PR commit ffd5ea53d3c3:

Available artifact names
  • artifacts-build-global
  • artifacts-build-local-aarch64-pc-windows-msvc
  • artifacts-build-local-x86_64-pc-windows-msvc
  • artifacts-build-local-x86_64-apple-darwin
  • artifacts-build-local-aarch64-apple-darwin
  • artifacts-build-local-x86_64-unknown-linux-musl
  • artifacts-build-local-x86_64-unknown-linux-gnu
  • artifacts-build-local-aarch64-unknown-linux-gnu
  • artifacts-plan-dist-manifest
  • cargo-dist-cache

@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit e3ee4ed into main Sep 11, 2026
25 checks passed
Abhijeet Prasad (AbhiPrasad) pushed a commit that referenced this pull request Sep 11, 2026
## Summary

Follow-up to #368, which merged before its automated review comments
were addressed. Both [Codex
findings](#368) were valid P2
edge cases; this PR fixes them.

## Fixes

**1. End the commit range at the released tag (not the dispatch SHA)**
On a manual `workflow_dispatch` where `inputs.tag` points at a different
commit than the run's `github.sha`, the range previously ran to the
branch tip. Now the endpoint is resolved from the tag when it already
exists, and falls back to the release commit otherwise (the normal push
flow, where the tag is created at that commit in the same job).

**2. Pick the previous tag from the release ancestry**
Re-publishing an older or backport release while a higher stable version
exists previously selected that newer tag as `previous_tag` (yielding an
empty/divergent `newer..older` log and an unrelated compare link). The
candidate search is now restricted to `git tag --merged <release
commit>`, so it picks the nearest preceding stable tag in the release's
own history.

Also drops an unused `range_heading` variable.

## Validation

Simulated both scenarios against the real repo history:

- **Normal push** (`v0.19.3`): previous tag `v0.19.2`, lists v0.19.3's
commits, compare `v0.19.2...v0.19.3`. ✅
- **Backport re-publish** (`v0.19.2` while `v0.19.3` exists): previous
tag correctly resolves to **`v0.19.1`** (old logic wrongly picked
`v0.19.3`), lists only v0.19.2's commits, compare `v0.19.1...v0.19.2`. ✅

Workflow YAML validated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- sfk:created-approved-by -->
Created by @AbhiPrasad

<!-- sfk:slack-thread -->
[Slack
thread](https://braintrustdata.slack.com/archives/C0AQDETAVT3/p1789074523886719?thread_ts=1789074523.886719&cid=C0AQDETAVT3)

Co-authored-by: Starfolk <noreply@starfolk.ai>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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