From bd0f2e840dbd416a1be927af8ae881cc118dbb6d Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Tue, 13 Feb 2024 13:43:27 +0100 Subject: [PATCH] feat: Added git-cliff configuration template --- cliff.toml | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/cliff.toml b/cliff.toml index d53fc37..332e031 100644 --- a/cliff.toml +++ b/cliff.toml @@ -25,26 +25,36 @@ body = """ {% endif %}\ {% set_global breaking_descriptions = [] %}\ -{% for commit in commits | filter(attribute="breaking_description") %}\ -{% set_global breaking_descriptions = breaking_descriptions | concat(with=commit.breaking_description) %}\ +{% for commit in commits | filter(attribute="breaking", value=true) %}\ + {% if commit.breaking_description %}\ + {% set_global breaking_descriptions = breaking_descriptions | concat(with=commit.breaking_description) %}\ + {% else %}\ + {% set_global breaking_descriptions = breaking_descriptions | concat(with=commit.message) %}\ + {% endif %}\ {% endfor %}\ {% if breaking_descriptions | length > 0 %} -### Breaking changes -{% for description in breaking_descriptions %} -- {{ description | upper_first }}\ -{% endfor %} + ### ⚠ Breaking changes + {% for description in breaking_descriptions %} + - {{ description | upper_first }}\ + {% endfor %} {% endif %}\ {% 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 }} - ([{{ commit.id | truncate(length=7, end="") }}](/commit/{{ commit.id }}))\ - {% if commit.links | length > 0 %}\ - {% for link in commit.links %}\ - ([{{ link.text }}]({{ link.href }}))\ - {% endfor %}\ - {% endif %}\ - {% endfor %} + ### {{ group | striptags | trim | upper_first }} + {% for commit in commits + | filter(attribute="scope") + | sort(attribute="scope") %} + - **({{commit.scope}})**{% if commit.breaking %} [**breaking**]{% endif %} \ + {{ commit.message }} - ([{{ commit.id | truncate(length=7, end="") }}](/commit/{{ commit.id }})) - {{ commit.author.name }} + {%- endfor -%} + {% raw %}\n{% endraw %}\ + {%- for commit in commits %} + {%- if commit.scope -%} + {% else -%} + - {% if commit.breaking %} [**breaking**]{% endif %}\ + {{ commit.message }} - ([{{ commit.id | truncate(length=7, end="") }}](/commit/{{ commit.id }})) - {{ commit.author.name }} + {% endif -%} + {% endfor -%} {% endfor %}\n """ # remove the leading and trailing whitespace from the template @@ -55,7 +65,7 @@ footer = """ """ # postprocessors postprocessors = [ - { pattern = '', replace = "https://gitlab.com/example-project/example-project/-/" }, + { pattern = '', replace = "https://gitlab.com/example-project/example-project/-" }, ] [git] # parse the commits based on https://www.conventionalcommits.org