From 01067efd1c859be8422b587c39a5d29010d49de8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Sat, 9 Aug 2025 20:21:59 +0300 Subject: [PATCH] chore(changelog): allow running git-cliff without release-plz (#2031) This is probably not optimal because we won't have access to the current `{package}` while running `git-cliff` but at least it will run _just_ fine. While at it, I changed something in the commit parsers to avoid adding dependency updates to the changelog. --------- Co-authored-by: Josh McKinney --- cliff.toml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cliff.toml b/cliff.toml index 15c08b4b..fb194034 100644 --- a/cliff.toml +++ b/cliff.toml @@ -24,7 +24,11 @@ body = """ {%- if not version %} ## [unreleased] {% else -%} +{%- if package -%} {# release-plz specific variable #} ## {{ package }} - [{{ version }}]({{ release_link }}) - {{ timestamp | date(format="%Y-%m-%d") }} +{%- else -%} +## [{{ version }}]({{ self::remote_url() }}/releases/tag/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }} +{%- endif %} {% endif -%} {% macro commit(commit) -%} @@ -59,14 +63,22 @@ body = """ {% if version %} {% if previous.version %} -**Full Changelog**: {{ release_link }} +{%- if release_link -%} +**Full Changelog**: {{ release_link }} {# release-plz specific variable #} +{%- else -%} +**Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }} +{% endif %} {% endif %} {% else -%} {% raw %}\n{% endraw %} {% endif %} {%- macro remote_url() -%} +{%- if remote.owner -%} {# release-plz specific variable #} https://github.com/{{ remote.owner }}/{{ remote.repo }}\ +{%- else -%} +https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\ +{%- endif -%} {% endmacro %} """ # remove the leading and trailing whitespace from the template @@ -114,9 +126,9 @@ commit_parsers = [ { message = "^chore\\(deps\\)", skip = true }, { message = "^chore\\(changelog\\)", skip = true }, { message = "^[cC]hore", group = "Miscellaneous Tasks" }, - { body = ".*security", group = "Security" }, { message = "^build\\(deps\\)", skip = true }, - { message = "^build", group = "Build" }, + { message = "^build", group = "Build" }, + { body = ".*security", group = "Security" }, { message = "^ci", group = "Continuous Integration" }, { message = "^revert", group = "Reverted Commits" }, # handle some old commits styles from pre 0.4