Skip to content

Commit 4b667a0

Browse files
committed
feat: add change log config
1 parent e48851c commit 4b667a0

File tree

2 files changed

+86
-1
lines changed

2 files changed

+86
-1
lines changed

src/cliff.toml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
[changelog]
2+
header = """
3+
# Changelog\n
4+
All notable changes to this project will be documented in this file.\n
5+
"""
6+
7+
body = """
8+
{% if version %}\
9+
{% if previous.version %}\
10+
# [{{ version | trim_start_matches(pat="v") }}](https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}/compare/{{ previous.version }}...{{ version }}) ({{ timestamp | date(format="%Y-%m-%d") }})
11+
{% else %}\
12+
# [{{ version | trim_start_matches(pat="v") }}] ({{ timestamp | date(format="%Y-%m-%d") }})
13+
{% endif %}\
14+
{% else %}\
15+
# [unreleased]
16+
{% endif %}\
17+
18+
{% macro group_commits(group_name) %}\
19+
{% for group, commits in commits | group_by(attribute="group") %}\
20+
{% if group == group_name %}\
21+
### {{ group | upper_first }}
22+
23+
{% for commit in commits %}\
24+
* {% if commit.scope %}**{{ commit.scope }}:** {% endif %}\
25+
{% if commit.breaking %}[**breaking**] {% endif %}\
26+
{{ commit.message }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}/commit/{{ commit.id }})) \
27+
[@{{ commit.author.name }}](https://github.com/{{ commit.author.name }})
28+
{% endfor %}
29+
30+
{% endif %}\
31+
{% endfor %}\
32+
{% endmacro %}\
33+
34+
{{ self::group_commits(group_name="Bug Fixes") }}\
35+
{{ self::group_commits(group_name="Features") }}\
36+
{{ self::group_commits(group_name="Performance") }}\
37+
{{ self::group_commits(group_name="Refactor") }}\
38+
{{ self::group_commits(group_name="Testing") }}\
39+
{{ self::group_commits(group_name="DevOps") }}\
40+
{{ self::group_commits(group_name="Documentation") }}\
41+
{{ self::group_commits(group_name="Styling") }}\
42+
{{ self::group_commits(group_name="Miscellaneous Tasks") }}\
43+
{{ self::group_commits(group_name="Security") }}\
44+
{{ self::group_commits(group_name="Revert") }}\
45+
\n
46+
"""
47+
48+
footer = """
49+
<!-- Generated by git-cliff. -->
50+
"""
51+
52+
trim = true
53+
postprocessors = []
54+
55+
56+
[git]
57+
conventional_commits = true
58+
filter_unconventional = true
59+
split_commits = false
60+
commit_preprocessors = [
61+
{ pattern = '^Revert "(.+)"$', replace = "revert $1" },
62+
]
63+
64+
commit_parsers = [
65+
{ message = "^fix", group = "Bug Fixes" },
66+
{ message = "^feat", group = "Features" },
67+
{ message = "^perf", group = "Performance" },
68+
{ message = "^refactor", group = "Refactor" },
69+
{ message = "^test", group = "Testing" },
70+
{ message = "^ci", group = "DevOps" },
71+
{ message = "^doc", group = "Documentation" },
72+
{ message = "^style", group = "Styling" },
73+
{ message = "^chore\\(release\\): prepare for", skip = true },
74+
{ message = "^chore\\(deps.*\\)", skip = true },
75+
{ message = "^chore\\(pr\\)", skip = true },
76+
{ message = "^chore\\(pull\\)", skip = true },
77+
{ message = "^chore", group = "Miscellaneous Tasks" },
78+
{ body = ".*security", group = "Security" },
79+
{ message = "^[Rr]evert", group = "Revert" },
80+
]
81+
82+
protect_breaking_commits = false
83+
filter_commits = false
84+
topo_order = false
85+
sort_commits = "oldest"

src/reusable-prepare-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
with:
3838
repository: 'leoweyr/github-release-workflow'
3939
path: .change-log-config
40-
sparse-checkout: cliff.toml
40+
sparse-checkout: src/cliff.toml
4141

4242
- name: Setup Node.js
4343
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)