mirror of
https://github.com/element-hq/synapse.git
synced 2025-12-12 00:01:45 -05:00
Remove "Updates to locked dependencies" section from changelog (#19254)
This commit is contained in:
parent
ffd0b4c079
commit
0dfc21ca9f
1
changelog.d/19254.removal
Normal file
1
changelog.d/19254.removal
Normal file
@ -0,0 +1 @@
|
|||||||
|
Remove the "Updates to locked dependencies" section from the changelog due to lack of use and the maintenance burden.
|
||||||
@ -32,7 +32,7 @@ import time
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
from os import path
|
from os import path
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
from typing import Any, Match
|
from typing import Any
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
import click
|
import click
|
||||||
@ -968,10 +968,6 @@ def generate_and_write_changelog(
|
|||||||
new_changes = new_changes.replace(
|
new_changes = new_changes.replace(
|
||||||
"No significant changes.", f"No significant changes since {current_version}."
|
"No significant changes.", f"No significant changes since {current_version}."
|
||||||
)
|
)
|
||||||
new_changes += build_dependabot_changelog(
|
|
||||||
repo,
|
|
||||||
current_version,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Prepend changes to changelog
|
# Prepend changes to changelog
|
||||||
with open("CHANGES.md", "r+") as f:
|
with open("CHANGES.md", "r+") as f:
|
||||||
@ -986,49 +982,5 @@ def generate_and_write_changelog(
|
|||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
|
|
||||||
|
|
||||||
def build_dependabot_changelog(repo: Repo, current_version: version.Version) -> str:
|
|
||||||
"""Summarise dependabot commits between `current_version` and `release_branch`.
|
|
||||||
|
|
||||||
Returns an empty string if there have been no such commits; otherwise outputs a
|
|
||||||
third-level markdown header followed by an unordered list."""
|
|
||||||
last_release_commit = repo.tag("v" + str(current_version)).commit
|
|
||||||
rev_spec = f"{last_release_commit.hexsha}.."
|
|
||||||
commits = list(git.objects.Commit.iter_items(repo, rev_spec))
|
|
||||||
messages = []
|
|
||||||
for commit in reversed(commits):
|
|
||||||
if commit.author.name == "dependabot[bot]":
|
|
||||||
message: str | bytes = commit.message
|
|
||||||
if isinstance(message, bytes):
|
|
||||||
message = message.decode("utf-8")
|
|
||||||
messages.append(message.split("\n", maxsplit=1)[0])
|
|
||||||
|
|
||||||
if not messages:
|
|
||||||
print(f"No dependabot commits in range {rev_spec}", file=sys.stderr)
|
|
||||||
return ""
|
|
||||||
|
|
||||||
messages.sort()
|
|
||||||
|
|
||||||
def replacer(match: Match[str]) -> str:
|
|
||||||
desc = match.group(1)
|
|
||||||
number = match.group(2)
|
|
||||||
return f"* {desc}. ([\\#{number}](https://github.com/element-hq/synapse/issues/{number}))"
|
|
||||||
|
|
||||||
for i, message in enumerate(messages):
|
|
||||||
messages[i] = re.sub(r"(.*) \(#(\d+)\)$", replacer, message)
|
|
||||||
messages.insert(0, "### Updates to locked dependencies\n")
|
|
||||||
# Add an extra blank line to the bottom of the section
|
|
||||||
messages.append("")
|
|
||||||
return "\n".join(messages)
|
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
|
||||||
@click.argument("since")
|
|
||||||
def test_dependabot_changelog(since: str) -> None:
|
|
||||||
"""Test building the dependabot changelog.
|
|
||||||
|
|
||||||
Summarises all dependabot commits between the SINCE tag and the current git HEAD."""
|
|
||||||
print(build_dependabot_changelog(git.Repo("."), version.Version(since)))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
cli()
|
cli()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user