Skip to content

Commit 47b4a0a

Browse files
committed
chore(changelog): add git-cliff configuration
1 parent 0607da3 commit 47b4a0a

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

cliff.toml

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
[remote.github]
5+
owner = "raphamorim"
6+
repo = "rio"
7+
8+
[changelog]
9+
# template for the changelog header
10+
header = """
11+
---
12+
title: 'Changelog'
13+
language: 'en'
14+
---
15+
16+
# Changelog
17+
18+
"""
19+
# template for the changelog body
20+
# https://keats.github.io/tera/docs/#introduction
21+
body = """
22+
{%- macro remote_url() -%}
23+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
24+
{%- endmacro -%}
25+
26+
{% if version -%}
27+
## {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }}
28+
{% else -%}
29+
## Unreleased
30+
{% endif -%}
31+
32+
{% for group, commits in commits | group_by(attribute="group") %}
33+
### {{ group | upper_first }}
34+
{%- for commit in commits %}
35+
- {{ commit.message | split(pat="\n") | first | upper_first | trim }}\
36+
{% if commit.github.username %} by @{{ commit.github.username }}{%- endif -%}
37+
{% if commit.github.pr_number %} in \
38+
[#{{ commit.github.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.github.pr_number }}) \
39+
{%- endif -%}
40+
{% endfor %}
41+
{% endfor %}
42+
43+
{%- if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
44+
## New Contributors
45+
{%- endif -%}
46+
47+
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
48+
* @{{ contributor.username }} made their first contribution
49+
{%- if contributor.pr_number %} in \
50+
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
51+
{%- endif %}
52+
{%- endfor %}\n
53+
"""
54+
# template for the changelog footer
55+
footer = """
56+
{%- macro remote_url() -%}
57+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
58+
{%- endmacro -%}
59+
60+
{% for release in releases -%}
61+
{% if release.version -%}
62+
{% if release.previous.version -%}
63+
[{{ release.version | trim_start_matches(pat="v") }}]: \
64+
{{ self::remote_url() }}/compare/{{ release.previous.version }}..{{ release.version }}
65+
{% endif -%}
66+
{% else -%}
67+
[unreleased]: {{ self::remote_url() }}/compare/{{ release.previous.version }}..HEAD
68+
{% endif -%}
69+
{% endfor %}
70+
<!-- generated by git-cliff -->
71+
"""
72+
# remove the leading and trailing whitespace from the templates
73+
trim = true
74+
75+
[git]
76+
# parse the commits based on https://www.conventionalcommits.org
77+
conventional_commits = true
78+
# filter out the commits that are not conventional
79+
filter_unconventional = false
80+
# regex for preprocessing the commit messages
81+
commit_preprocessors = [
82+
# remove issue numbers from commits
83+
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
84+
]
85+
# regex for parsing and grouping commits
86+
commit_parsers = [
87+
{ message = "^[a|A]dd", group = "Added" },
88+
{ message = "^[s|S]upport", group = "Added" },
89+
{ message = "^[r|R]emove", group = "Removed" },
90+
{ message = "^test", group = "Fixed" },
91+
{ message = "^fix", group = "Fixed" },
92+
{ message = "^.*: fix", group = "Fixed" },
93+
{ message = "^.*", group = "Changed" },
94+
]
95+
# filter out the commits that are not matched by commit parsers
96+
filter_commits = false
97+
# sort the tags topologically
98+
topo_order = false
99+
# sort the commits inside sections by oldest/newest order
100+
sort_commits = "newest"

0 commit comments

Comments
 (0)