Skip to content

Commit 58fb6c0

Browse files
committed
feat(changelog): add git cliff config to generate changelogs
1 parent 42eba8d commit 58fb6c0

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

cliff.toml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[changelog]
2+
header = "# Changelog\n\n"
3+
body = """
4+
{%- if version -%}
5+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
6+
{%- else -%}
7+
## [unreleased]
8+
{%- endif %}
9+
{% for group, commits in commits | group_by(attribute="group") %}
10+
### {{ group | upper_first }}
11+
{% for commit in commits | sort(attribute="message") %}
12+
- {% if commit.scope %}{{ commit.scope }}: {% endif %}
13+
{{- commit.message | upper_first }}
14+
{%- if commit.breaking %} (breaking){% endif %}
15+
{%- set fixes = commit.footers | filter(attribute="token", value="Fixes") %}
16+
{%- for fix in fixes %}{% if fix.separator|trim == '#' %}{{ fix.separator }}{{ fix.value }}{% endif %}{% endfor %}
17+
{%- endfor %}
18+
{% endfor %}
19+
20+
"""
21+
footer = ""
22+
23+
# remove the leading and trailing whitespaces from the template
24+
trim = true
25+
26+
[git]
27+
# allow only conventional commits
28+
# https://www.conventionalcommits.org
29+
conventional_commits = true
30+
# regex for parsing and grouping commits
31+
commit_parsers = [
32+
{ message = "^chore\\(release\\): version", skip = true},
33+
{ message = "^feat", group = "Features"},
34+
{ message = "^fix", group = "Bug Fixes"},
35+
{ message = "^doc", group = "Documentation"},
36+
{ message = "^perf", group = "Performance"},
37+
{ message = "^test", group = "Testing"},
38+
{ message = "^chore", group = "Miscellaneous Tasks"},
39+
{ body = ".*security", group = "Security"},
40+
]
41+
# filter out the commits that are not matched by commit parsers
42+
filter_commits = false
43+
# regex for matching git tags
44+
tag_pattern = "^v[0-9]+\\.[0-9]+\\.[0-9]+.*"

0 commit comments

Comments
 (0)