Skip to content

Match changelog headings against whole lines only - #5

Merged
firefoxic merged 1 commit into
mainfrom
heading-detection
Aug 30, 2026
Merged

firefoxic merged 1 commit into
mainfrom
heading-detection

Conversation

@firefoxic

Copy link
Copy Markdown
Owner

What went wrong

6.0.0 shipped with no breaking changes in it. The [Unreleased] section had only ### Added and ### Fixed, but one of the Added entries said “Below 1.0.0, ### Changed now bumps the minor version…” — and the heading detector greps the whole section text for the substring ### Changed, so the mention counted as the heading.

Fix

The three headings are matched against whole lines (grep -x), which is what a heading is. A heading with trailing text (### Changed things) no longer matches either and falls through to the existing “does not follow the expected format” error, like any other unknown heading.

Also

  • Two tests in tests/version-detection.test.sh; the suite is at 98 passing.
  • CHANGELOG.md entry under ### Fixed — the next release is 6.0.1. 6.0.0 stays as it is: it is already on npm and it is harmless, only one major too many.

The bump was decided by grepping the [Unreleased] text for the bare
substring `### Changed`, so an entry that merely mentioned the heading
— “`### Changed` now bumps the minor version” — counted as one. That is
how 6.0.0 came to be: an Added/Fixed release turned major by its own
release notes.

`grep -x` anchors the match to a whole line, which is what a heading
is. A heading with trailing text no longer matches either, and falls
through to the “unexpected format” error as any other unknown heading.
@firefoxic
firefoxic merged commit 89f60a5 into main Aug 30, 2026
2 checks passed
@firefoxic
firefoxic deleted the heading-detection branch August 30, 2026 21:45
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