Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/scripts/changelog_guard_mutate.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
("a PR with no check job gets a warning", ' return f"#{n}: no {JOB} job on', ' return None\n return f"#{n}: no {JOB} job on'),
("a failure on one PR doesn't stop the loop", " except (CmdError, KeyError, ValueError) as e:\n warns.append", " except ZeroDivisionError as e:\n warns.append"),
("modes exit 0 when listing fails", " except (CmdError, KeyError, ValueError) as e:\n return report", " except ZeroDivisionError as e:\n return report"),
("override warning retains changed-line details", 'f"{label}: {h} (allowed by the {OVERRIDE} label)"',
"f\"{label}: {h.split(':')[0]} (allowed by the {OVERRIDE} label)\""),
# Regexes
("H3 strips trailing space", 'H3 = re.compile(r"^### +(.+?)\\s*$")', 'H3 = re.compile(r"^### +(.+)$")'),
("BULLET is top-level only", 'BULLET = re.compile(r"^[-*+]\\s+(.*\\S)")', 'BULLET = re.compile(r"^\\s*[-*+]\\s+(.*\\S)")'),
Expand Down
15 changes: 12 additions & 3 deletions .github/scripts/changelog_guard_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,12 @@ def test_released_edit_fails_and_label_overrides(self):
self.f.get(1)["labels"] = ["other", "changelog-override"]
p = self.f.run("pr", 1)
self.assertPass(p)
self.assertIn("::warning", p.stdout)
self.assertTrue(any(
line.startswith("::warning title=changelog-guard::")
and "changes released section [1.0.0]" in line
and "`- First release`" in line
and "(allowed by the changelog-override label)" in line
for line in p.stdout.splitlines()), p.stdout)

def test_label_does_not_clear_other_errors(self):
self.f.pr(1, add_unreleased("- Existing fix", base=BASE_CL.replace("- First release", "- First")),
Expand All @@ -253,8 +258,12 @@ def test_deleted_changelog_fails_and_label_overrides(self):
self.f.get(1)["labels"] = ["changelog-override"]
p = self.f.run("pr", 1)
self.assertPass(p)
self.assertIn("::warning", p.stdout)
self.assertIn("changes released section [1.0.0]", p.stdout)
self.assertTrue(any(
line.startswith("::warning title=changelog-guard::")
and "changes released section [1.0.0]" in line
and "`- First release`" in line
and "(allowed by the changelog-override label)" in line
for line in p.stdout.splitlines()), p.stdout)

def test_empty_changelog_fails(self):
self.f.pr(1, "")
Expand Down
Loading