Skip to content

Commit

Permalink
Do not clobber existing release summary. (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein authored Apr 28, 2024
1 parent 62c44db commit 80e8dad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/597-release_summary-overwrite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- "The ``prepare`` subcommand will no longer overwrite an existing release summary in the ``changelog.yaml`` file (https://github.com/ansible-community/antsibull/pull/597)."
1 change: 1 addition & 0 deletions src/antsibull/build_ansible_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ def prepare_command() -> int:
f"Release Date: {date}"
f"\n\n"
f"`Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`_",
overwrite_release_summary=False,
)
ansible_changelog.changes.save()

Expand Down
12 changes: 10 additions & 2 deletions src/antsibull/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ def concatenate(cls, changelogs: list[ChangelogData]) -> ChangelogData:
)

def add_ansible_release(
self, version: str, date: datetime.date, release_summary: str
self,
version: str,
date: datetime.date,
release_summary: str,
overwrite_release_summary: bool = True,
) -> None:
add_release(
self.config,
Expand All @@ -132,7 +136,11 @@ def add_ansible_release(
release_date = self.changes.releases[version]
if "changes" not in release_date:
release_date["changes"] = {}
release_date["changes"]["release_summary"] = release_summary
if (
"release_summary" not in release_date["changes"]
or overwrite_release_summary
):
release_date["changes"]["release_summary"] = release_summary


def read_file(tarball_path: str, matcher: t.Callable[[str], bool]) -> bytes | None:
Expand Down

0 comments on commit 80e8dad

Please sign in to comment.