Skip to content

fix: CHANGELOG.md missing version entry causes release-please frontmatter mangling #169

@WilliamBerryiii

Description

@WilliamBerryiii

Summary

PR #168 fails markdown linting because CHANGELOG.md lacks a version entry, causing release-please to mangle the file structure.

Root Cause

When release-please's updateContent() method runs on a CHANGELOG.md that has no version entry matching its regex ('\n###? v?[0-9[]'), it takes the "no version found" code path which:

  1. Prepends # Changelog\n header
  2. Adds the new changelog entry
  3. Calls adjustHeaders() on all existing content (including frontmatter)
  4. Appends the adjusted content at the end of the file

This results in the YAML frontmatter being pushed to the bottom of the file, causing these markdown lint failures:

  • MD003: --- misinterpreted as setext heading style
  • MD012: Multiple consecutive blank lines
  • MD022: Headings not surrounded by blank lines
  • MD013: Line too long (description field)

Solution

Seed CHANGELOG.md with a ## 0.0.0 (Initial) placeholder version entry. This triggers release-please's "version found" path which uses:

const before = content.slice(0, lastEntryIndex);

This preserves everything before the first version header, including YAML frontmatter.

Affected PR

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions