Skip to content

fix(release): populate changelog and server-changes on release/dispatch#4204

Merged
carderne merged 3 commits into
mainfrom
claude/fix-dispatch-empty-changelog
Jul 9, 2026
Merged

fix(release): populate changelog and server-changes on release/dispatch#4204
carderne merged 3 commits into
mainfrom
claude/fix-dispatch-empty-changelog

Conversation

@claude

@claude claude Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Requested by Chris Arderne · Slack thread

This PR fixes two related release-pipeline bugs. It also supersedes #4209, whose server-changes fix is folded in here.

Before:

  • Re-running the release via workflow_dispatch (the recovery path after a merge-triggered run fails) produced a GitHub release with no "What's changed" section — the changelog came out empty and publishing still succeeded, so it failed silently.
  • .server-changes/*.md entries were dropped from the release PR body and the release notes: the working-tree .server-changes/ directory is emptied by cleanup-server-changes.mjs before enhance-release-pr.mjs reads it, so the ## Server changes section never appeared.

After:

  • On the workflow_dispatch path the changelog is resolved from the merged changeset-release/main PR, and a stable (non-prerelease) release now fails loudly instead of publishing an empty changelog.
  • The enhance step recovers the deleted .server-changes entries from git, so the ## Server changes section is populated in both the release PR body and the published GitHub release.

How:

  • The "What's changed" section was built solely from github.event.pull_request.body, which is only populated on the pull_request: [closed] event. On a workflow_dispatch run there is no pull_request context, so it was empty.
  • .github/workflows/release.yml ("Create unified GitHub release" step): when RELEASE_PR_BODY is empty (the dispatch path), fall back to the body of the most recently merged changeset-release/main PR via gh pr list (using the step's existing GH_TOKEN). The pull_request merge path is unchanged.
  • scripts/generate-github-release.mjs: after extracting the changelog, exit non-zero with a clear error when a non-prerelease resolves no "What's changed" content, so an empty changelog can't publish silently again. Prereleases (any version with a hyphen) remain exempt.
  • scripts/enhance-release-pr.mjs: when the working-tree .server-changes/ directory has already been cleaned up, recover the deleted entries from git — merge-base the base and release refs, list files deleted under .server-changes with git diff --diff-filter=D, and read each one back with git show <mergeBase>:<path>. Recovery failures are now logged instead of being silently swallowed.

✅ Checklist

  • The PR title follows the convention.
  • I ran and tested the code works

Testing

Ran node --check scripts/generate-github-release.mjs and node --check scripts/enhance-release-pr.mjs (both parse clean) and exercised the changelog script directly:

  • Non-empty RELEASE_PR_BODY for a stable version renders the "## What's changed" section as before.
  • Empty RELEASE_PR_BODY for a stable version (e.g. 4.5.2) exits 1 with a clear error and writes no release body.
  • Empty RELEASE_PR_BODY for a prerelease (e.g. 4.5.0-rc.0) exits 0 and omits the section (unchanged, expected).

Changelog

Resolve the release changelog from the merged changeset-release/main PR on workflow_dispatch reruns, fail the release loudly when a non-prerelease resolves an empty changelog, and recover .server-changes entries from git so the server-changes section is populated even after the working-tree directory has been cleaned up.


Generated by Claude Code

The "What's changed" section was built solely from
github.event.pull_request.body, which is only present on the
pull_request merge event. On a workflow_dispatch re-run that context
is empty, so the GitHub release published with an empty changelog and
failed silently.

Resolve RELEASE_PR_BODY robustly: fall back to the body of the most
recently merged changeset-release/main PR when the pull_request context
is absent. Also fail loudly in generate-github-release.mjs when a
non-prerelease resolves no changelog content, so an empty changelog can
no longer publish silently. Prereleases remain exempt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014CjQVhMqLbRo3VuLaGSLfg
@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: bc44c89

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Read .server-changes from git when the working tree copy has already been cleaned up, and log recovery failures instead of swallowing them. Folds in the fix from #4209.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014CjQVhMqLbRo3VuLaGSLfg
@carderne carderne marked this pull request as ready for review July 9, 2026 16:21
@claude claude Bot changed the title fix(release): populate changelog on workflow_dispatch reruns fix(release): populate changelog and server-changes on release/dispatch Jul 9, 2026
@claude claude Bot marked this pull request as draft July 9, 2026 16:22
@carderne carderne marked this pull request as ready for review July 9, 2026 16:23
devin-ai-integration[bot]

This comment was marked as resolved.

…er/or

Combine working-tree and git-recovered server-change files (dedup by filename) so a partial cleanup can't drop entries from the release notes.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

Open in Devin Review

Comment thread scripts/generate-github-release.mjs
@carderne carderne merged commit 105f489 into main Jul 9, 2026
25 of 29 checks passed
@carderne carderne deleted the claude/fix-dispatch-empty-changelog branch July 9, 2026 16:46
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.

3 participants