Skip to content

Throw if release section is empty#275

Merged
mcmire merged 4 commits intomainfrom
add-no-empty-releases
Feb 26, 2026
Merged

Throw if release section is empty#275
mcmire merged 4 commits intomainfrom
add-no-empty-releases

Conversation

@mcmire
Copy link
Contributor

@mcmire mcmire commented Feb 23, 2026

Currently, a release section is valid if it is empty, i.e., has no changelog entries. This commit reverses that behavior.


Note

Medium Risk
Behavioral change to validateChangelog that can newly fail existing changelogs/CI if they contain header-only releases; otherwise limited to validation logic.

Overview
validateChangelog now enforces that every release section contains at least one changelog entry, throwing a new EmptyReleaseError when a release has zero categorized items.

Tests are updated to expect this failure for empty releases (both RC and non-RC scenarios), and the CHANGELOG.md notes this as a breaking change.

Written by Cursor Bugbot for commit f20d3fc. This will update automatically on new commits. Configure here.

Add a new option which will throw an error if any release sections have
no changelog entries.
@mcmire mcmire requested a review from a team as a code owner February 23, 2026 16:26
src/cli.ts Outdated
* Whether to validate that each release section has one or more changelog
* entries (true) or not (false).
*/
noEmptyReleases: boolean;
Copy link
Contributor

@cryptodev-2s cryptodev-2s Feb 23, 2026

Choose a reason for hiding this comment

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

Nit: what do you think about renaming this to rejectEmptyReleases or ensureNonEmptyReleases to use similar tone of other options ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good callout. This does seem a bit off. How does --disallowEmptyReleases sound?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes sounds good to me!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ended up removing the option entirely: f20d3fc

src/cli.ts Outdated
type: 'boolean',
})
.option('noEmptyReleases', {
default: false,
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason to not enable this functionality by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but it would be a breaking change, since any changelogs that already have empty release sections would fail validation now. So I was a bit hesitant to make that change now. That said, I suspect that most projects' changelogs are compliant and would require no work to upgrade. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

IMO worth it to make the breaking change and deal with the limited invalid changelogs that will come up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I've made this behavior the default here: f20d3fc

@mcmire mcmire changed the title Check for empty release sections with --noEmptyReleases Throw if release section is empty Feb 26, 2026
Copy link
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

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

LGTM!

@mcmire mcmire merged commit 555223b into main Feb 26, 2026
25 checks passed
@mcmire mcmire deleted the add-no-empty-releases branch February 26, 2026 15:43
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