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: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:

tag = os.environ["GITHUB_REF"].removeprefix("refs/tags/v")
text = Path("CHANGELOG.md").read_text()
pattern = rf"^## \\[{re.escape(tag)}\\].*?$(.*?)(?=^## \\[|\\Z)"
pattern = rf"^## \[{re.escape(tag)}\].*?$(.*?)(?=^## \[|\Z)"
match = re.search(pattern, text, re.MULTILINE | re.DOTALL)
if not match:
raise SystemExit(f"CHANGELOG.md does not contain release notes for ## [{tag}]")
Expand Down
15 changes: 15 additions & 0 deletions tests/test_release_workflow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import re
from pathlib import Path

WORKFLOW = Path(".github/workflows/release.yml")
CHANGELOG = Path("CHANGELOG.md")


def _workflow_text() -> str:
Expand Down Expand Up @@ -34,3 +36,16 @@ def test_release_workflow_creates_github_release_from_changelog() -> None:
assert "release-notes.md" in text
assert "gh release create" in text
assert "dist/*" in text


def test_release_notes_regex_extracts_current_changelog_entry() -> None:
tag = "0.1.1"
text = CHANGELOG.read_text()
pattern = rf"^## \[{re.escape(tag)}\].*?$(.*?)(?=^## \[|\Z)"

match = re.search(pattern, text, re.MULTILINE | re.DOTALL)

assert match is not None
notes = match.group(1).strip()
assert notes
assert "MemSnapDump" in notes
Loading