Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare subcommand: do not clobber existing release summary #597

Merged
merged 1 commit into from
Apr 28, 2024
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: 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