Skip to content

Commit 1717a38

Browse files
committed
chore(scripts): better handling of prereleases
1 parent c5e3f24 commit 1717a38

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

scripts/extract_release_notes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ def main() -> None:
2323
version = get_version()
2424

2525
changelog = Path("CHANGELOG.md").read_text()
26+
if version.prerelease:
27+
version = "Unreleased"
2628

2729
regex = re.compile(
2830
rf"^\#\#\s*\[({version})\][^\n]*?\n(?P<text>.*?)^\#\#\s+",

scripts/update_changelog.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,20 @@ def run(title: str, *args: Any, **kwargs: Any) -> None:
3232

3333
def main() -> None:
3434
current_version = get_version()
35-
36-
run(
37-
"create changelog",
38-
f"git-cliff --bump -t v{current_version} -o CHANGELOG.md",
39-
shell=True,
40-
timeout=600,
41-
)
35+
if current_version.prerelease:
36+
run(
37+
"create changelog",
38+
"git-cliff -o CHANGELOG.md",
39+
shell=True,
40+
timeout=600,
41+
)
42+
else:
43+
run(
44+
"create changelog",
45+
f"git-cliff --bump -t v{current_version} -o CHANGELOG.md",
46+
shell=True,
47+
timeout=600,
48+
)
4249

4350

4451
if __name__ == "__main__":

0 commit comments

Comments
 (0)