phly / keep-a-changelog

Tools for manipulating CHANGELOG.md files in Keep A Changelog format, including tagging and releasing.
https://phly.github.io/keep-a-changelog/
BSD 2-Clause "Simplified" License
182 stars 23 forks source link

feat: support a verbose heading for the changelog #80

Closed ramsey closed 4 years ago

ramsey commented 4 years ago

This PR addresses the reason I stumbled upon #79.

I tend to use headings similar to the following for my CHANGELOG.md files:

# ramsey/devtools Changelog

When I ran keep-a-changelog bump against an existing (created before installing phly/keep-a-changelog) CHANGELOG.md, I got the following error (after applying the patch from PR #79):

Unable to find any changelog entries in file /path/to/ramsey/devtools/CHANGELOG.md; is it formatted correctly? 

This error occurs because the regular expression in ChangelogBump::updateChangelog() expects a strict heading of:

# Changelog

Since Keep A Changelog is not an exact specification (it's a convention), I would like to relax the strictness here. I still think the word "changelog" should be in the heading, so this new regular expression enforces this, but it allows for content to come before and after the word "changelog," and it allows "changelog" to be case-insensitive.