Skip to content

Commit ab3fe66

Browse files
committed
Replace gitchangelog with git-cliff
gitchangelog doesn't look very maintained anymore. Git cliff makes for a more modern replacement that is a little easier to install as well.
1 parent 1516797 commit ab3fe66

File tree

3 files changed

+71
-313
lines changed

3 files changed

+71
-313
lines changed

Diff for: .gitchangelog.rc

-312
This file was deleted.

Diff for: cliff.toml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# https://git-cliff.org/docs/configuration
2+
3+
[changelog]
4+
# changelog header
5+
header = """
6+
# Changelog\n
7+
"""
8+
# template for the changelog body
9+
# https://keats.github.io/tera/docs/#introduction
10+
body = """
11+
{% if version -%}\
12+
## {{ version }} ({{ timestamp | date(format="%Y-%m-%d") }})
13+
{% else -%}\
14+
## [unreleased]
15+
{% endif %}\
16+
{% set grouped_commits = commits | group_by(attribute="group") %}\
17+
{% set_global groups = [] %}\
18+
{% for group, commits in grouped_commits -%}\
19+
{% set_global groups = groups | concat(with=group) %}\
20+
{% endfor -%}\
21+
{% for group in groups | sort %}
22+
### {{ group | split(pat=" ") | slice(start=1) | join(sep=" ") | upper_first }}
23+
{% for commit in grouped_commits[group] -%}
24+
{% for line in commit.message | split(pat="\\n") -%}\
25+
{% if loop.first %}
26+
- {{ line | upper_first }} [{{ commit.author.name }}]{% else %} {{ line | trim }} {% endif %}
27+
{% endfor -%}
28+
{% endfor -%}
29+
{% endfor %}\n
30+
"""
31+
trim = false
32+
footer = """
33+
<!-- generated by git-cliff -->
34+
"""
35+
postprocessors = [
36+
{ pattern = "- ([Nn]ew|[Ff]ix|[Cc]hg):\\s*(.*)", replace = "- $2" },
37+
]
38+
39+
[git]
40+
# parse the commits based on https://www.conventionalcommits.org
41+
conventional_commits = false
42+
# filter out the commits that are not conventional
43+
filter_unconventional = false
44+
# process each line of a commit as an individual commit
45+
split_commits = false
46+
# regex for preprocessing the commit messages
47+
commit_preprocessors = [
48+
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"}, # replace issue numbers
49+
]
50+
# regex for parsing and grouping commits
51+
commit_parsers = [
52+
{ body = "!skip_changelog", skip = true },
53+
{ message = "^[Nn]ew:\\s*(.*)", group = "01. New" },
54+
{ message = "^[Ff]ix:\\s*(.*)", group = "02. Fixes" },
55+
{ message = "^[Cc]hg:\\s*(.*)", group = "03. Changes" },
56+
{ field = "author.name", pattern = "(dependabot|renovate)\\[bot\\]", skip = true },
57+
{ message = ".*", group = "10. Other" },
58+
]
59+
60+
# protect breaking changes from being skipped due to matching a skipping commit_parser
61+
protect_breaking_commits = false
62+
# filter out the commits that are not matched by commit parsers
63+
filter_commits = false
64+
# regex for matching git tags
65+
tag_pattern = "v[0-9].*"
66+
67+
# sort the tags topologically
68+
topo_order = false
69+
# sort the commits inside sections by oldest/newest order
70+
sort_commits = "oldest"

Diff for: make-new-release.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ cargo check
2424
git commit "Cargo.*" --message "Release v${VERSION}"
2525
git tag "v${VERSION}"
2626

27-
gitchangelog
27+
git cliff --latest --prepend CHANGES.md > /dev/null
2828
${EDITOR:-vim} CHANGES.md
2929
docs/generate.sh
3030
git add CHANGES.md README.md

0 commit comments

Comments
 (0)