Skip to content

Commit

Permalink
Fix "Keep A Changelog" version detection (#16)
Browse files Browse the repository at this point in the history
* Detect the correct version block in "Keep A Changelog" formatted changelogs.

* End change detection on footer links.
  • Loading branch information
marcusrbrown authored and MoOx committed Jan 22, 2018
1 parent 236543e commit b96ea68
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions github-release-from-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,16 @@ changelogLines.some(function(line, i) {
if (
!start &&
(line.indexOf("# " + version) === 0 ||
(isKeepAChangelogFormat && line.indexOf("## [") === 0))
(isKeepAChangelogFormat && line.indexOf("## [" + version) === 0))
) {
start = true;
} else if (
start &&
(line.indexOf("# ") === 0 ||
(isKeepAChangelogFormat && line.indexOf("## [") === 0))
(isKeepAChangelogFormat && line.indexOf("## [") === 0) ||
(line.indexOf("[") === 0))
) {
// end with another # version
// end with another # version or a footer link
return true;
} else if (start) {
// between start & end, collect lines
Expand Down

0 comments on commit b96ea68

Please sign in to comment.