Skip to content

Commit 3ee7774

Browse files
committed
doc: Add initial git-cliff configuration
Updating the changelog always has been very time-consuming. Using git-cliff will help tremendously cutting down the time to update it. It, however, relies on the git commits using the conventional commits convention, which likely going to introduce as of version 2.8.0. Signed-off-by: Sacha Telgenhof <[email protected]>
1 parent 2c63a9f commit 3ee7774

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed

cliff.toml

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
#
4+
# Lines starting with "#" are comments.
5+
# Configuration options are organized into tables and keys.
6+
# See documentation for more information on available options.
7+
8+
[remote.github]
9+
owner = "azuyalabs"
10+
repo = "yasumi"
11+
12+
[changelog]
13+
14+
# changelog header
15+
header = """
16+
# Changelog\n
17+
All notable changes to this project will be documented in this file.
18+
19+
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and
20+
[Conventional Commits](https://conventionalcommits.org) for commit conventions.
21+
22+
Changes related to the logic of the holidays or their providers are listed first,
23+
followed by any architectural or technical changes.\n
24+
"""
25+
26+
# template for the changelog body
27+
# https://keats.github.io/tera/docs/#introduction
28+
body = """
29+
{% if version -%}
30+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
31+
{% else -%}
32+
## [Unreleased]
33+
{% endif -%}
34+
35+
{% for group, commits in commits | group_by(attribute="group") %}
36+
### {{ group | striptags | trim | upper_first }}
37+
{% for commit in commits %}
38+
- {% if commit.scope %}({{ commit.scope | upper_first }}) {% endif%}{{ commit.message | split(pat="\n") | first | split(pat=": ") | last | trim | upper_first }}\
39+
{% endfor %}
40+
{% endfor %}
41+
42+
{%- if github -%}
43+
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
44+
## New Contributors ❤️
45+
{% endif %}\
46+
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
47+
* @{{ contributor.username }} made their first contribution
48+
{%- endfor -%}
49+
{%- endif %}\n\n
50+
"""
51+
52+
# template for the changelog footer
53+
footer = """
54+
{% for release in releases -%}
55+
{% if release.version -%}
56+
{% if release.previous.version -%}
57+
[{{ release.version | trim_start_matches(pat="v") }}]: \
58+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
59+
/compare/{{ release.previous.version }}..{{ release.version }}
60+
{% endif -%}
61+
{% else -%}
62+
[unreleased]: https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
63+
/compare/{{ release.previous.version }}..HEAD
64+
{% endif -%}
65+
{% endfor %}
66+
"""
67+
68+
# remove the leading and trailing whitespace from the templates
69+
trim = true
70+
71+
[git]
72+
73+
# parse the commits based on https://www.conventionalcommits.org
74+
conventional_commits = true
75+
76+
# filter out the commits that are not conventional
77+
filter_unconventional = true
78+
79+
# process each line of a commit as an individual commit
80+
split_commits = false
81+
82+
# preprocessors for manipulating the commit messages before parsing/grouping them
83+
commit_preprocessors = [
84+
{ pattern = "\\(#([0-9]+)\\)", replace = "([#${1}](https://github.com/azuyalabs/yasumi/issues/${1}))"}
85+
]
86+
87+
# regex for parsing and grouping commits
88+
commit_parsers = [
89+
{ message = "^feat", group = "<!-- 0 -->Features" },
90+
{ message = "^fix", group = "<!-- 1 -->Fixes" },
91+
{ message = "^refactor", group = "<!-- 2 -->Refactor" },
92+
{ message = "^perf", group = "<!-- 3 -->Performance" },
93+
{ message = "^doc", group = "<!-- 4 -->Documentation" },
94+
{ message = "^style", group = "<!-- 5 -->Code Style" },
95+
{ message = "^test", group = "<!-- 6 -->Testing" },
96+
{ message = "^chore|^ci|^build", group = "<!-- 7 -->Other" },
97+
98+
# skip merge commits
99+
{ message = "^[Mm]erge", skip = true },
100+
]
101+
102+
# protect breaking changes from being skipped due to matching a skipping commit_parser
103+
protect_breaking_commits = false
104+
105+
# filter out the commits that are not matched by commit parsers
106+
filter_commits = true
107+
108+
# regex for matching git tags
109+
tag_pattern = "[0-9].*"
110+
111+
# regex for skipping tags
112+
skip_tags = "beta|alpha"
113+
114+
# regex for ignoring tags
115+
ignore_tags = ""
116+
117+
# sort the tags topologically
118+
topo_order = true
119+
120+
# sort the commits inside sections by oldest/newest order
121+
sort_commits = "newest"

0 commit comments

Comments
 (0)