Skip to content

Commit d8a3b99

Browse files
committed
feat(changelog): add git-cliff
1 parent bad7d62 commit d8a3b99

File tree

1 file changed

+140
-0
lines changed

1 file changed

+140
-0
lines changed

cliff.toml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# git-cliff ~ default 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 = "lalvarezt"
10+
# repo = "string_pipeline"
11+
12+
[changelog]
13+
# changelog header
14+
header = """
15+
# Changelog
16+
17+
All notable changes to this project will be documented in this file.
18+
<!-- ignore lint rules that are often triggered by content generated from commits / git-cliff -->
19+
<!-- markdownlint-disable line-length no-bare-urls ul-style emphasis-style -->
20+
"""
21+
22+
# A Tera template to be rendered for each release in the changelog.
23+
# See https://keats.github.io/tera/docs/#introduction
24+
body = """
25+
{%- macro remote_url() -%}
26+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
27+
{%- endmacro -%}
28+
29+
{% macro print_commit(commit) -%}
30+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
31+
{% if commit.breaking %}[**breaking**] {% endif %}\
32+
{{ commit.message | upper_first }} - \
33+
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
34+
{% endmacro -%}
35+
36+
{% if version %}\
37+
{% if previous.version %}\
38+
## [{{ version | trim_start_matches(pat="v") }}]\
39+
({{ self::remote_url() }}/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
40+
{% else %}\
41+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
42+
{% endif %}\
43+
{% else %}\
44+
## [unreleased]
45+
{% endif %}\
46+
47+
{% for group, commits in commits | group_by(attribute="group") %}
48+
### {{ group | striptags | trim | upper_first }}
49+
{% for commit in commits
50+
| filter(attribute="scope")
51+
| sort(attribute="scope") %}
52+
{{ self::print_commit(commit=commit) }}
53+
{%- endfor %}
54+
{% for commit in commits %}
55+
{%- if not commit.scope -%}
56+
{{ self::print_commit(commit=commit) }}
57+
{% endif -%}
58+
{% endfor -%}
59+
{% endfor -%}
60+
{%- if github -%}
61+
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
62+
## New Contributors ❤️
63+
{% endif %}\
64+
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
65+
* @{{ contributor.username }} made their first contribution
66+
{%- if contributor.pr_number %} in \
67+
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
68+
{%- endif %}
69+
{%- endfor -%}
70+
{%- endif %}
71+
72+
73+
"""
74+
75+
# A Tera template to be rendered as the changelog's footer.
76+
# See https://keats.github.io/tera/docs/#introduction
77+
footer = """
78+
<!-- generated by git-cliff -->
79+
"""
80+
# Remove leading and trailing whitespaces from the changelog's body.
81+
trim = true
82+
# An array of regex based postprocessors to modify the changelog.
83+
postprocessors = [
84+
# Replace the placeholder `<REPO>` with a URL.
85+
# { pattern = 'string_pipeline', replace = "https://github.com/lalvarezt/string_pipeline" }, # replace repository URL
86+
]
87+
88+
[git]
89+
# parse the commits based on https://www.conventionalcommits.org
90+
conventional_commits = true
91+
# filter out the commits that are not conventional
92+
filter_unconventional = true
93+
# process each line of a commit as an individual commit
94+
split_commits = false
95+
# regex for preprocessing the commit messages
96+
commit_preprocessors = [
97+
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
98+
{ pattern = '(Update README.md)', replace = "docs(readme): ${1}" },
99+
]
100+
# regex for parsing and grouping commits
101+
commit_parsers = [
102+
{ message = "^feat", group = "<!-- 0 -->⛰️ Features" },
103+
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
104+
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
105+
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
106+
{ message = "^refactor\\(clippy\\)", skip = true },
107+
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
108+
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
109+
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
110+
{ message = "^chore\\(release\\): prepare for", skip = true },
111+
{ message = "^chore\\(deps.*\\)", skip = true },
112+
{ message = "^chore\\(pr\\)", skip = true },
113+
{ message = "^chore\\(pull\\)", skip = true },
114+
{ message = "^chore\\(npm\\).*yarn\\.lock", skip = true },
115+
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
116+
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
117+
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
118+
]
119+
# Prevent commits that are breaking from being excluded by commit parsers.
120+
protect_breaking_commits = false
121+
# Exclude commits that are not matched by any commit parser.
122+
filter_commits = false
123+
# Regex to select git tags that represent releases.
124+
tag_pattern = "[0-9].*"
125+
# Regex to select git tags that do not represent proper releases.
126+
# Takes precedence over `tag_pattern`.
127+
# Changes belonging to these releases will be included in the next release.
128+
skip_tags = "beta|alpha"
129+
# Regex to exclude git tags after applying the tag_pattern.
130+
# ignore_tags = "rc|v2.1.0|v2.1.1"
131+
# Order releases topologically instead of chronologically.
132+
topo_order = false
133+
# Order of commits in each group/release within the changelog.
134+
# Allowed values: newest, oldest
135+
sort_commits = "newest"
136+
137+
[bump]
138+
features_always_bump_minor = true
139+
breaking_always_bump_major = false
140+
initial_tag = "0.1.0"

0 commit comments

Comments
 (0)