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

chore: Remove CHANGELOG header from PR/Release contents #733

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
12 changes: 8 additions & 4 deletions scripts/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ def _get_changes() -> dict[str, list[str]]:
return dict(changes)


def _write_new_section(version: str, changes: dict[str, list[str]]) -> str:
body = f"## [{version}] - {datetime.now(tz.gettz('EST')).strftime('%Y-%m-%d')}\n"
def _get_new_section() -> str:
changes = _get_changes()
body = ""
for prefix, section in SECTION_TO_PREFIX.items():
if prefix not in changes:
continue
body += f"\n### {section}\n\n"
for change in changes[prefix]:
body += f"- {change}\n"

body += "\n"
return body


Expand All @@ -62,8 +62,12 @@ def _update_changelog(version: str) -> str:
with open(changelog_file, "w") as f:
for line in contents:
if line.startswith("## ") and not body:
body = _write_new_section(version, _get_changes())
body = _get_new_section()
f.write(
f"## [{version}] - {datetime.now(tz.gettz('EST')).strftime('%Y-%m-%d')}\n"
)
f.write(body)
f.write("\n")
f.write(line)

return body
Expand Down
Loading