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 <joshka@users.noreply.github.com>
This commit is contained in:
Orhun Parmaksız 2025-08-09 20:21:59 +03:00 committed by GitHub
parent ae4f42f5ae
commit 01067efd1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 = "<!-- 07 -->Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 08 -->Security" },
{ message = "^build\\(deps\\)", skip = true },
{ message = "^build", group = "<!-- 09 -->Build" },
{ message = "^build", group = "<!-- 08 -->Build" },
{ body = ".*security", group = "<!-- 09 -->Security" },
{ message = "^ci", group = "<!-- 10 -->Continuous Integration" },
{ message = "^revert", group = "<!-- 11 -->Reverted Commits" },
# handle some old commits styles from pre 0.4