diff --git a/.github/scripts/release_notes_by_component.py b/.github/scripts/release_notes_by_component.py index 1fedcdeb16..6faf420cbe 100644 --- a/.github/scripts/release_notes_by_component.py +++ b/.github/scripts/release_notes_by_component.py @@ -204,7 +204,8 @@ def split_notes(body): start = next((i for i, l in enumerate(lines) if l.strip() == "## What's Changed"), None) if start is None: return [], body, "" - end = next((i for i in range(start + 1, len(lines)) if lines[i].startswith("## ")), len(lines)) + end = next((i for i in range(start + 1, len(lines)) + if lines[i].startswith(("## ", "**Full Changelog**"))), len(lines)) prs = [l for l in lines[start + 1:end] if PR_LINE.match(l)] before = "\n".join(lines[:start]).rstrip() after = "\n".join(lines[end:]).strip() diff --git a/.github/scripts/test_release_notes_by_component.py b/.github/scripts/test_release_notes_by_component.py index add73802a9..057e1f5e98 100644 --- a/.github/scripts/test_release_notes_by_component.py +++ b/.github/scripts/test_release_notes_by_component.py @@ -146,6 +146,13 @@ class RegroupTest(unittest.TestCase): for n in (12709, 12707, 12685, 12366, 12600): self.assertEqual(out.count("/pull/%d\n" % n), 2 if n == 12600 else 1) + def test_changelog_kept_without_new_contributors(self): + body = NOTES.replace( + "## New Contributors\n* @c made their first contribution in https://github.com/seaweedfs/seaweedfs/pull/12600\n\n", "") + out = rn.regroup(body, self.files) + self.assertTrue(out.endswith("\n\n**Full Changelog**: https://github.com/seaweedfs/seaweedfs/compare/4.53...4.54\n"), out) + self.assertEqual(rn.regroup(out, self.files), out) + def test_notes_without_prs_unchanged(self): body = "Hand-written notes\n\n**Full Changelog**: x" self.assertEqual(rn.regroup(body, no_files), body)