Fix changelog entry insertion when no package title is present in the `CHANGELOG.md` file by mixelburg · Pull Request #1859 · changesets/changesets

@mixelburg

…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 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

Mar 2, 2026

Andarist

@Andarist

Merged via the queue into changesets:main with commit 1772598

Mar 2, 2026

5 of 6 checks passed