Fix changelog entry insertion when no package title is present in the `CHANGELOG.md` file by mixelburg · Pull Request #1859 · changesets/changesets
…on headings
When a CHANGELOG.md file starts directly with a version heading (e.g. ## 1.3.0)
rather than a package title heading (e.g. # my-package), new version entries were
incorrectly inserted after the existing version heading line instead of before it.
This caused changelogs like:
## 1.3.0 <- existing
## 1.4.0 <- new entry, wrongly placed under old heading
### Minor Changes
...
### Minor Changes <- old content appears to be under new heading
...
The fix detects whether the first line of the changelog is a version heading using
/^#{1,6}\s+\d+\.\d+/ regex. When it is, the new entry is prepended before the
entire file content instead of after the first line.
Fixes changesets#1056
added 6 commits
March 2, 2026 11:44
Andarist
changed the title
fix(apply-release-plan): insert changelog entry before existing version headings
Fix changelog entry insertion when no package title is present in the CHANGELOG.md file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters