diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a7e4b1f4c..5c8f1c17d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,7 @@ Each Pull Request usually has a changelog file that describes the changes made i Changelog files are placed in the `changelog/` directory and used to generate the Release Notes for the upcoming release. Preview of the Release Notes is automatically added as comment to each Pull Request. The changelog file needs to follow the naming convention -`YYYYMMDD--.md`. To create changelog file please use the +`YYYYMMDD--.md`. To create changelog file please use the `scripts/release/create_changelog.py` script. Example usage: ```console @@ -34,7 +34,7 @@ usage: create_changelog.py [-h] [-c ] [-d ] [-e] -k title Utility to easily create a new changelog entry file. positional arguments: - title Title for the changelog entry + title Title used in changelog filename and passed as initial file contents options: -h, --help show this help message and exit diff --git a/scripts/release/changelog.py b/scripts/release/changelog.py index 458947b4e..112be6173 100644 --- a/scripts/release/changelog.py +++ b/scripts/release/changelog.py @@ -35,10 +35,9 @@ def from_str(kind_str: str) -> "ChangeKind": class ChangeEntry: - def __init__(self, date: datetime, kind: ChangeKind, title: str, contents: str): + def __init__(self, date: datetime, kind: ChangeKind, contents: str): self.date = date self.kind = kind - self.title = title self.contents = contents @@ -129,7 +128,7 @@ def extract_changelog_entry_from_contents(file_contents: str) -> ChangeEntry: ## Add newline to contents so the Markdown file also contains a newline at the end contents = data.content + "\n" - return ChangeEntry(date=date, title=str(data["title"]), kind=kind, contents=contents) + return ChangeEntry(date=date, kind=kind, contents=contents) def get_changelog_filename(title: str, kind: ChangeKind, date: datetime) -> str: diff --git a/scripts/release/create_changelog.py b/scripts/release/create_changelog.py index 15a83f39d..2722df6b9 100644 --- a/scripts/release/create_changelog.py +++ b/scripts/release/create_changelog.py @@ -53,7 +53,7 @@ - '{str(ChangeKind.FIX)}' for bugfix entries - '{str(ChangeKind.OTHER)}' for other entries""", ) - parser.add_argument("title", type=str, help="Title for the changelog entry") + parser.add_argument("title", type=str, help="Title used in changelog filename and passed as initial file contents") args = parser.parse_args() title = args.title @@ -72,10 +72,10 @@ with open(changelog_path, "w") as f: # Add frontmatter based on args f.write("---\n") - f.write(f"title: {title}\n") f.write(f"kind: {str(kind)}\n") f.write(f"date: {date_str}\n") f.write("---\n\n") + f.write(f"* {title}\n") if args.editor: editor = os.environ.get("EDITOR", "vi") # Fallback to vim if EDITOR is not set diff --git a/scripts/release/tests/changelog_test.py b/scripts/release/tests/changelog_test.py index 283bb2b49..1d820c044 100644 --- a/scripts/release/tests/changelog_test.py +++ b/scripts/release/tests/changelog_test.py @@ -69,7 +69,6 @@ def test_strip_changelog_entry_frontmatter(): change_entry = extract_changelog_entry_from_contents(file_contents) - assert change_entry.title == "This is my change" assert change_entry.kind == ChangeKind.FEATURE assert change_entry.date == datetime.date(2025, 7, 10) assert (