Skip to content

Commit 341ec79

Browse files
committed
chore: introduce git-cliff for CHANGELOG generation
1 parent 8c0e889 commit 341ec79

File tree

9 files changed

+14579
-1065
lines changed

9 files changed

+14579
-1065
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ repos:
3333
language: system
3434
types:
3535
- "javascript"
36+
- repo: https://github.com/commitizen-tools/commitizen
37+
rev: 3.12.0
38+
hooks:
39+
- id: commitizen
40+
- id: commitizen-branch
41+
stages: [push]

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{
1919
"label": "robotcode: bump version",
2020
"type": "shell",
21-
"command": "hatch run build:cz bump",
21+
"command": "hatch run build:bump",
2222
"problemMatcher": []
2323
},
2424
{

CHANGELOG.md

Lines changed: 780 additions & 1058 deletions
Large diffs are not rendered by default.

cliff.toml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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+
[changelog]
9+
# changelog header
10+
header = """
11+
# Changelog\n
12+
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.\n
13+
"""
14+
# template for the changelog body
15+
# https://keats.github.io/tera/docs/#introduction
16+
body = """
17+
{% if version %}\
18+
{% if previous.version %}\
19+
## [{{ version | trim_start_matches(pat="v") }}]($REPO/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
20+
{% else %}\
21+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
22+
{% endif %}\
23+
{% else %}\
24+
## [unreleased]
25+
{% endif %}\
26+
{% for group, commits in commits | group_by(attribute="group") %}
27+
### {{ group | upper_first }}
28+
{% for commit in commits
29+
| filter(attribute="scope")
30+
| sort(attribute="scope") %}
31+
- **{{commit.scope}}:** {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]($REPO/commit/{{ commit.id }}))
32+
{%- if commit.breaking %}
33+
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
34+
{%- endif -%}
35+
{% if commit.body %}\n\n{{ commit.body | trim | indent(prefix=" ", first=true) }}\n{% endif -%}
36+
{%- endfor -%}
37+
{% raw %}\n{% endraw %}\
38+
{%- for commit in commits %}
39+
{%- if commit.scope -%}
40+
{% else -%}
41+
- {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]($REPO/commit/{{ commit.id }}))
42+
{% if commit.breaking -%}
43+
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
44+
{% endif -%}
45+
{% if commit.body %}\n\n{{ commit.body | trim | indent(prefix=" ", first=true) }}\n{% endif -%}
46+
{% endif -%}
47+
{% endfor -%}
48+
{% raw %}\n{% endraw %}\
49+
{% endfor %}\n
50+
"""
51+
# remove the leading and trailing whitespace from the template
52+
trim = true
53+
# changelog footer
54+
footer = """
55+
<!-- generated by git-cliff -->
56+
"""
57+
# postprocessors
58+
postprocessors = [
59+
{ pattern = '\$REPO', replace = "https://github.com/d-biehl/robotcode" }, # replace repository URL
60+
]
61+
[git]
62+
# parse the commits based on https://www.conventionalcommits.org
63+
conventional_commits = true
64+
# filter out the commits that are not conventional
65+
filter_unconventional = true
66+
# process each line of a commit as an individual commit
67+
split_commits = false
68+
# regex for preprocessing the commit messages
69+
commit_preprocessors = [
70+
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"}, # replace issue numbers
71+
]
72+
# regex for parsing and grouping commits
73+
commit_parsers = [
74+
{ message = "^feat", group = "Features" },
75+
{ message = "^Feat", group = "Features" },
76+
{ message = "^Feature", group = "Features" },
77+
{ message = "^fix", group = "Bug Fixes" },
78+
{ message = "^doc", group = "Documentation" },
79+
{ message = "^perf", group = "Performance" },
80+
{ message = "^refactor", group = "Refactor" },
81+
{ message = "^style", group = "Styling" },
82+
{ message = "^test", group = "Testing" },
83+
{ message = "^chore\\(release\\): prepare for", skip = true },
84+
{ message = "^chore\\(deps\\)", skip = true },
85+
{ message = "^chore\\(pr\\)", skip = true },
86+
{ message = "^chore\\(pull\\)", skip = true },
87+
{ message = "^chore|ci", group = "Miscellaneous Tasks", skip = true },
88+
{ message = "^bump", skip = true },
89+
{ body = ".*security", group = "Security" },
90+
{ message = "^revert", group = "Revert" },
91+
]
92+
# protect breaking changes from being skipped due to matching a skipping commit_parser
93+
protect_breaking_commits = false
94+
# filter out the commits that are not matched by commit parsers
95+
filter_commits = true
96+
# regex for matching git tags
97+
tag_pattern = "v[0-9]+\\.[0-9]+\\.[0-9]+-*"
98+
99+
# regex for skipping tags
100+
skip_tags = "v[0-9]+\\.[0-9]+\\.[0-9]+-alpha\\.[0-9]+"
101+
# regex for ignoring tags
102+
ignore_tags = ""
103+
# sort the tags topologically
104+
topo_order = false
105+
# sort the commits inside sections by oldest/newest order
106+
sort_commits = "oldest"
107+
# limit the number of commits included in the changelog.
108+
# limit_commits = 42

0 commit comments

Comments
 (0)