Skip to content

Commit

Permalink
chore(changelog): show scopes and commit links
Browse files Browse the repository at this point in the history
  • Loading branch information
martinohmann committed Jan 3, 2024
1 parent b8315aa commit 26041ff
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,25 @@ body = """
{% else %}\
## [unreleased]
{% endif %}\
{% macro commit(commit) -%}
- {% if commit.scope %}**{{ commit.scope }}**: {% endif %}{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }} - ([{{ commit.id | truncate(length=7, end="") }}](<REPO>/commit/{{ commit.id }}))\
{% endmacro -%}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
{% endfor %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
{{ self::commit(commit=commit) }}
{%- endfor -%}
{% raw %}\n{% endraw %}\
{%- for commit in commits %}
{%- if not commit.scope -%}
{{ self::commit(commit=commit) }}
{% endif -%}
{% endfor -%}
{% endfor %}\n
"""
# remove the leading and trailing whitespace from the template
Expand All @@ -34,7 +48,7 @@ footer = """
"""
# postprocessors
postprocessors = [
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
{ pattern = '<REPO>', replace = "https://github.com/martinohmann/dts" },
]
[git]
# parse the commits based on https://www.conventionalcommits.org
Expand Down

0 comments on commit 26041ff

Please sign in to comment.