Skip to content

Commit

Permalink
feat: Added git-cliff configuration template
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Feb 13, 2024
1 parent 2d514a8 commit bd0f2e8
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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="") }}](<REPO>/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="") }}](<REPO>/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="") }}](<REPO>/commit/{{ commit.id }})) - {{ commit.author.name }}
{% endif -%}
{% endfor -%}
{% endfor %}\n
"""
# remove the leading and trailing whitespace from the template
Expand All @@ -55,7 +65,7 @@ footer = """
"""
# postprocessors
postprocessors = [
{ pattern = '<REPO>', replace = "https://gitlab.com/example-project/example-project/-/" },
{ pattern = '<REPO>', replace = "https://gitlab.com/example-project/example-project/-" },
]
[git]
# parse the commits based on https://www.conventionalcommits.org
Expand Down

0 comments on commit bd0f2e8

Please sign in to comment.