Skip to content

Commit f7af1e4

Browse files
committed
feat: add git-cliff configuration
1 parent d8b9d27 commit f7af1e4

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

cliff.toml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
[changelog]
5+
# A Tera template to be rendered as the changelog's header.
6+
# See https://keats.github.io/tera/docs/#introduction
7+
header = """
8+
# Changelog\n
9+
All notable changes to this project will be documented in this file.
10+
11+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
12+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
13+
"""
14+
# A Tera template to be rendered for each release in the changelog.
15+
# See https://keats.github.io/tera/docs/#introduction
16+
body = """
17+
{% if version -%}
18+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
19+
{% else -%}
20+
## [Unreleased]
21+
{% endif -%}
22+
{% for group, commits in commits | group_by(attribute="group") %}
23+
### {{ group | upper_first }}
24+
{% for commit in commits %}
25+
- {{ commit.message | split(pat="\n") | first | upper_first | trim }}\
26+
{% endfor %}
27+
{% endfor %}\n
28+
"""
29+
# A Tera template to be rendered as the changelog's footer.
30+
# See https://keats.github.io/tera/docs/#introduction
31+
footer = """
32+
{% for release in releases -%}
33+
{% if release.version -%}
34+
{% if release.previous.version -%}
35+
[{{ release.version | trim_start_matches(pat="v") }}]: \
36+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
37+
/compare/{{ release.previous.version }}..{{ release.version }}
38+
{% else -%}
39+
[{{ release.version | trim_start_matches(pat="v") }}]: \
40+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
41+
/tree/{{ release.version }}
42+
{% endif -%}
43+
{% else -%}
44+
[unreleased]: https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
45+
/compare/{{ release.previous.version }}..HEAD
46+
{% endif -%}
47+
{% endfor %}
48+
<!-- generated by git-cliff -->
49+
"""
50+
# Remove leading and trailing whitespaces from the changelog's body.
51+
trim = true
52+
53+
[git]
54+
# Parse commits according to the conventional commits specification.
55+
# See https://www.conventionalcommits.org
56+
conventional_commits = true
57+
# Exclude commits that do not match the conventional commits specification.
58+
filter_unconventional = false
59+
# An array of regex based parsers for extracting data from the commit message.
60+
# Assigns commits to groups.
61+
# Optionally sets the commit's scope and can decide to exclude commits from further processing.
62+
commit_parsers = [
63+
{ message = "^[a|A]dd", group = "Added" },
64+
{ message = "^[s|S]upport", group = "Added" },
65+
{ message = "^[r|R]emove", group = "Removed" },
66+
{ message = "^.*: add", group = "Added" },
67+
{ message = "^.*: support", group = "Added" },
68+
{ message = "^.*: remove", group = "Removed" },
69+
{ message = "^.*: delete", group = "Removed" },
70+
{ message = "^test", group = "Fixed" },
71+
{ message = "^fix", group = "Fixed" },
72+
{ message = "^.*: fix", group = "Fixed" },
73+
{ message = "^.*", group = "Changed" },
74+
]
75+
# Prevent commits that are breaking from being excluded by commit parsers.
76+
filter_commits = false
77+
# Order releases topologically instead of chronologically.
78+
topo_order = false
79+
# Order of commits in each group/release within the changelog.
80+
# Allowed values: newest, oldest
81+
sort_commits = "oldest"

0 commit comments

Comments
 (0)