From 8cd1d56b4a72c71b015548dad1b9a767dc7db254 Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sun, 30 Aug 2026 14:20:40 +0100 Subject: [PATCH] Save extracted changelog in workspace --- scripts/get_changelog.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/get_changelog.py b/scripts/get_changelog.py index 4db43e3..16b99c2 100644 --- a/scripts/get_changelog.py +++ b/scripts/get_changelog.py @@ -2,9 +2,9 @@ import os import re import argparse from pathlib import Path -from tempfile import mkstemp VERSION_HEADER = re.compile(r"\[\d+.\d+.\d+\]") +SCRIPT_DIR = Path(__file__).absolute().parent.parent def main(): @@ -19,8 +19,7 @@ def main(): def get_changelog(version: str) -> list[str]: - script_dir = Path(__file__).absolute().parent.parent - changelog = script_dir / "CHANGELOG.md" + changelog = SCRIPT_DIR / "CHANGELOG.md" with changelog.open("r") as infile: lines = infile.readlines() @@ -47,10 +46,10 @@ def get_changelog(version: str) -> list[str]: def save_changelog(version: str, lines: list[str]) -> str: - fd, name = mkstemp(prefix=f"wapp-changelog-{version}-", text=True) - os.write(fd, "".join(lines).encode("utf-8")) - os.close(fd) - return name + version_changelog = SCRIPT_DIR / f"wapp-changelog-{version}.md" + with version_changelog.open("w") as outfile: + outfile.writelines(lines) + return str(version_changelog) if __name__ == "__main__":