Skip to content

Commit 266ba23

Browse files
committed
add git-cliff
1 parent 09d08be commit 266ba23

2 files changed

Lines changed: 80 additions & 33 deletions

File tree

cliff.toml

Lines changed: 79 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,94 @@
1-
# SPDX-License-Identifier: Apache-2.0
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
24

35
[changelog]
4-
header = "# Changelog\n\n"
6+
# A Tera template to be rendered for each release in the changelog.
7+
# See https://keats.github.io/tera/docs/#introduction
58
body = """
69
{% if version %}\
7-
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
10+
## [v{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
811
{% else %}\
9-
## [Unreleased]
12+
## [unreleased]
1013
{% endif %}\
1114
{% for group, commits in commits | group_by(attribute="group") %}
12-
13-
### {{ group | striptags | trim | upper_first }}
14-
{% for commit in commits %}
15-
- {% if commit.scope %}**{{ commit.scope }}:** {% endif %}{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}/commit/{{ commit.id }}))
16-
{%- endfor %}
17-
{% endfor %}\n
15+
### {{ group | striptags | trim | upper_first }}
16+
{% for commit in commits %}
17+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
18+
{% if commit.breaking %}[**breaking**] {% endif %}\
19+
{{ commit.message | upper_first }}\
20+
{% endfor %}
21+
{% endfor %}
1822
"""
23+
# Remove leading and trailing whitespaces from the changelog's body.
1924
trim = true
20-
footer = """
21-
"""
25+
# Render body even when there are no releases to process.
26+
render_always = true
27+
# An array of regex based postprocessors to modify the changelog.
28+
postprocessors = [
29+
# Replace the placeholder <REPO> with a URL.
30+
#{ pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" },
31+
]
32+
# render body even when there are no releases to process
33+
# render_always = true
34+
# output file path
35+
# output = "test.md"
2236

2337
[git]
38+
# Parse commits according to the conventional commits specification.
39+
# See https://www.conventionalcommits.org
2440
conventional_commits = true
25-
filter_unconventional = false
41+
# Exclude commits that do not match the conventional commits specification.
42+
filter_unconventional = true
43+
# Require all commits to be conventional.
44+
# Takes precedence over filter_unconventional.
45+
require_conventional = false
46+
# Split commits on newlines, treating each line as an individual commit.
2647
split_commits = false
27-
tag_pattern = "v[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].[0-9][0-9]"
28-
sort_commits = "oldest"
29-
48+
# An array of regex based parsers to modify commit messages prior to further processing.
49+
commit_preprocessors = [
50+
# Replace issue numbers with link templates to be updated in `changelog.postprocessors`.
51+
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
52+
# Check spelling of the commit message using https://github.com/crate-ci/typos.
53+
# If the spelling is incorrect, it will be fixed automatically.
54+
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
55+
]
56+
# Prevent commits that are breaking from being excluded by commit parsers.
57+
protect_breaking_commits = false
58+
# An array of regex based parsers for extracting data from the commit message.
59+
# Assigns commits to groups.
60+
# Optionally sets the commit's scope and can decide to exclude commits from further processing.
3061
commit_parsers = [
31-
{ message = "^feat", group = "Features" },
32-
{ message = "^fix", group = "Fixes" },
33-
{ message = "^perf", group = "Performance" },
34-
{ message = "^docs?", group = "Documentation" },
35-
{ message = "^test", group = "Tests" },
36-
{ message = "^build", group = "Build" },
37-
{ message = "^ci", group = "CI" },
38-
{ message = "^refactor", group = "Refactoring" },
39-
{ message = "^security", group = "Security" },
40-
{ message = "^revert", group = "Reverts" },
41-
{ message = "^chore\\(release\\):", skip = true },
42-
{ message = "^chore", group = "Chores" },
43-
{ message = ".*", group = "Other" },
62+
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
63+
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
64+
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
65+
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
66+
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
67+
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
68+
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
69+
{ message = "^chore\\(release\\): prepare for", skip = true },
70+
{ message = "^chore\\(deps.*\\)", skip = true },
71+
{ message = "^chore\\(pr\\)", skip = true },
72+
{ message = "^chore\\(pull\\)", skip = true },
73+
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
74+
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
75+
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
76+
{ message = ".*", group = "<!-- 10 -->💼 Other" },
4477
]
45-
46-
[remote.github]
47-
owner = "inngest"
48-
repo = "ssdb"
78+
# Exclude commits that are not matched by any commit parser.
79+
filter_commits = false
80+
# Fail on a commit that is not matched by any commit parser.
81+
fail_on_unmatched_commit = false
82+
# An array of link parsers for extracting external references, and turning them into URLs, using regex.
83+
link_parsers = []
84+
# Include only the tags that belong to the current branch.
85+
use_branch_tags = false
86+
# Order releases topologically instead of chronologically.
87+
topo_order = false
88+
# Order commits topologically instead of chronologically.
89+
topo_order_commits = true
90+
# Order of commits in each group/release within the changelog.
91+
# Allowed values: newest, oldest
92+
sort_commits = "oldest"
93+
# Process submodules commits
94+
recurse_submodules = false

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
pythonEnv
109109
wabt
110110
zstd
111+
git-cliff
111112
]);
112113

113114
shellHook = lib.optionalString pkgs.stdenv.isDarwin ''

0 commit comments

Comments
 (0)