Skip to content

Commit 8d9ec5f

Browse files
committed
improve changelog parse
1 parent 549c972 commit 8d9ec5f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Command/ReleaseCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ private function parseChangelog($pull)
241241
{
242242
$changelog = array();
243243
$body = preg_replace('/<!--(.*)-->/Uis', '', $pull['body']);
244-
preg_match('/## Changelog.*```\s*markdown\s*\\n(.*)\\n```.*/is', $body, $matches);
244+
preg_match('/## Changelog.*```\s*markdown\s*\\n(.*)\\n```/Uis', $body, $matches);
245245

246246
if (count($matches) == 2) {
247247
$lines = explode(PHP_EOL, $matches[1]);
@@ -255,7 +255,7 @@ private function parseChangelog($pull)
255255
}
256256

257257
if (0 === strpos($line, '#')) {
258-
$section = end(explode(' ', $line));
258+
$section = preg_replace('/^#* /i', '', $line);
259259
} elseif (!empty($section)) {
260260
$line = preg_replace('/^- /i', '', $line);
261261
$changelog[$section][] = '- [[#'.$pull['number'].']('.$pull['html_url'].')] '.

0 commit comments

Comments
 (0)