From 639caf057db22628b92f30152e9282f0cc795c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= <76261501+zecakeh@users.noreply.github.com> Date: Tue, 18 Jul 2023 18:52:38 +0200 Subject: [PATCH] Fix rendered changelog with new version of towncrier (#1598) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kévin Commaille --- .../internal/newsfragments/1598.clarification | 1 + changelogs/pyproject.toml | 53 ++++++++++++++----- changelogs/template.md.jinja | 24 +++++++++ scripts/generate-changelog.sh | 11 +--- scripts/requirements.txt | 4 +- 5 files changed, 69 insertions(+), 24 deletions(-) create mode 100644 changelogs/internal/newsfragments/1598.clarification create mode 100644 changelogs/template.md.jinja diff --git a/changelogs/internal/newsfragments/1598.clarification b/changelogs/internal/newsfragments/1598.clarification new file mode 100644 index 00000000..1077e83c --- /dev/null +++ b/changelogs/internal/newsfragments/1598.clarification @@ -0,0 +1 @@ +Fix rendered changelog with new version of towncrier. diff --git a/changelogs/pyproject.toml b/changelogs/pyproject.toml index d32f6415..d42c96d6 100644 --- a/changelogs/pyproject.toml +++ b/changelogs/pyproject.toml @@ -1,39 +1,66 @@ [tool.towncrier] version = "unused" - filename = "../rendered.md" - issue_format = "[#{issue}](https://github.com/matrix-org/matrix-spec/issues/{issue})" - title_format = "### {name}" # Matches rendered spec, even if awkward - underlines = " " # 3 spaces intentionally to hide RST headings - - # Note: The names below have the tag built-in so the rendered spec *and* the generated - # changelog can benefit from sane headings. + filename = "rendered.md" + template = "template.md.jinja" [[tool.towncrier.type]] directory = "breaking" - name = "Breaking Changes" + name = "Breaking Changes" showcontent = true [[tool.towncrier.type]] directory = "deprecation" - name = "Deprecations" + name = "Deprecations" showcontent = true [[tool.towncrier.type]] directory = "new" - name = "New Endpoints" + name = "New Endpoints" showcontent = true [[tool.towncrier.type]] directory = "removal" - name = "Removed Endpoints" + name = "Removed Endpoints" showcontent = true [[tool.towncrier.type]] directory = "feature" - name = "Backwards Compatible Changes" + name = "Backwards Compatible Changes" showcontent = true [[tool.towncrier.type]] directory = "clarification" - name = "Spec Clarifications" + name = "Spec Clarifications" showcontent = true + + [[tool.towncrier.section]] + name = "Client-Server API" + path = "client_server" + + [[tool.towncrier.section]] + name = "Server-Server API" + path = "server_server" + + [[tool.towncrier.section]] + name = "Application Service API" + path = "application_service" + + [[tool.towncrier.section]] + name = "Identity Service API" + path = "identity_service" + + [[tool.towncrier.section]] + name = "Push Gateway API" + path = "push_gateway" + + [[tool.towncrier.section]] + name = "Room Versions" + path = "room_versions" + + [[tool.towncrier.section]] + name = "Appendices" + path = "appendices" + + [[tool.towncrier.section]] + name = "Internal Changes/Tooling" + path = "internal" diff --git a/changelogs/template.md.jinja b/changelogs/template.md.jinja new file mode 100644 index 00000000..38de4b92 --- /dev/null +++ b/changelogs/template.md.jinja @@ -0,0 +1,24 @@ +{% for section_name, section in sections.items() %} +{% if section_name %} + +### {{section_name}} +{% endif %} + +{% if section %} +{% for category, val in definitions.items() if category in section %} +**{{ definitions[category]['name'] }}** + +{% for content, issues in section[category].items() %} +- {{ content }} ( +{%- for issue in issues %} +[{{issue}}](https://github.com/matrix-org/matrix-spec/issues/{{issue|trim('#')}}){% if not loop.last %}, {% endif %} +{%- endfor %} +) +{% endfor %} + +{% endfor %} +{% else %} +No significant changes. + +{% endif %} +{% endfor %} diff --git a/scripts/generate-changelog.sh b/scripts/generate-changelog.sh index 73e59940..45132619 100755 --- a/scripts/generate-changelog.sh +++ b/scripts/generate-changelog.sh @@ -13,15 +13,8 @@ cd `dirname $0`/../changelogs # Pre-cleanup just in case it wasn't done on the last run rm -f rendered.md -# Reversed order so that room versions ends up on the bottom -towncrier --name "Internal Changes/Tooling" --dir "./internal" --config "./pyproject.toml" --yes -towncrier --name "Appendices" --dir "./appendices" --config "./pyproject.toml" --yes -towncrier --name "Room Versions" --dir "./room_versions" --config "./pyproject.toml" --yes -towncrier --name "Push Gateway API" --dir "./push_gateway" --config "./pyproject.toml" --yes -towncrier --name "Identity Service API" --dir "./identity_service" --config "./pyproject.toml" --yes -towncrier --name "Application Service API" --dir "./application_service" --config "./pyproject.toml" --yes -towncrier --name "Server-Server API" --dir "./server_server" --config "./pyproject.toml" --yes -towncrier --name "Client-Server API" --dir "./client_server" --config "./pyproject.toml" --yes +# Generate changelog +towncrier --yes { # Prepare the header diff --git a/scripts/requirements.txt b/scripts/requirements.txt index a3ff4f0b..0349d87f 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -2,8 +2,8 @@ # current at the time of writing # we need at least version 4.0.0 for support of JSON Schema Draft 2020-12. -jsonschema >= 4.0.0 +jsonschema == 4.17.3 PyYAML >= 3.12 requests >= 2.18.4 -towncrier == 21.9.0rc1 +towncrier == 23.6.0