-
Notifications
You must be signed in to change notification settings - Fork 0
/
cliff.toml
96 lines (90 loc) · 4.26 KB
/
cliff.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
[bump] # https://git-cliff.org/docs/configuration/bump
features_always_bump_minor = false
breaking_always_bump_major = false
initial_tag = "0.0.0"
[changelog] # https://git-cliff.org/docs/configuration/changelog
header = """# Changelog"""
# https://github.com/orhun/git-cliff/blob/main/cliff.toml
body = """
{%- macro remote_url() -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
{%- macro print_commit(commit) -%}
- {% if commit.scope -%}**{{ commit.scope }}:** {% endif -%}\
{{ commit.message }} - \
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))
{%- endmacro -%}
{%- if version -%}
{%- if previous.version -%}
## [{{ version | trim_start_matches(pat="v") }}]\
({{ self::remote_url() }}/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y%m%d") }}
{%- else -%}
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y%m%d") }}
{%- endif -%}
{%- else -%}
## [unreleased]
{%- endif %}
{% for group, commits in commits | group_by(attribute="group") -%}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits | filter(attribute="scope") | sort(attribute="scope") -%}
{{ self::print_commit(commit=commit) }}
{% endfor -%}
{% for commit in commits -%}
{%- if not commit.scope -%}
{{ self::print_commit(commit=commit) }}
{% endif -%}
{%- endfor -%}
{%- endfor -%}
{%- if github -%}
{%- if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 -%}
## ❤️ New Contributors
{% endif -%}
{%- for contributor in github.contributors | filter(attribute="is_first_time", value=true) -%}
- @{{ contributor.username }} made their first contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }})
{%- endif %}
{% endfor -%}
{%- endif -%}
"""
footer = ""
trim = true
render_always = false
postprocessors = []
output = "CHANGELOG.md"
[git] # https://git-cliff.org/docs/configuration/git
conventional_commits = true
filter_unconventional = false
split_commits = false
commit_preprocessors = [
# https://git-cliff.org/docs/tips-and-tricks#remove-gitmoji
# Remove gitmoji, both actual UTF emoji and :emoji:
{ pattern = ' *(:\w+:|[\p{Emoji_Presentation}\p{Extended_Pictographic}](?:\u{FE0F})?\u{200D}?) *', replace = "" },
]
commit_parsers = [
# https://github.com/arvinxx/gitmoji-commit-workflow/blob/8f21e287ec3c3f5144f3a606a3c737bea6d67e80/packages/changelog/src/transformer/typeDisplayName.ts
# https://github.com/conventional-changelog/conventional-changelog/blob/65550d9a30cfab4b00b3e982e42bd68fedafcefc/packages/conventional-changelog-conventionalcommits/src/constants.js
# https://github.com/lobehub/lobe-cli-toolbox/blob/09ce889f879850d8bc081da5df420c87b99379ac/packages/lobe-commit/src/constants/gitmojis.ts
{ message = '^(?<type>\w+)(\((?<scope>\w+)\))?(?<breaking>!):', group = "<!-- 00 -->💥 Breaking Change" },
{ message = "BREAKING CHANGE", group = "<!-- 00 -->💥 Breaking Change" },
{ message = "pre-commit autoupdate", skip = true },
{ message = "sync with (repo|repository) template", skip = true },
{ message = "sync with template (repo|repository)", skip = true },
{ message = "update pre-commit hooks", skip = true },
{ message = '^(?<type>\w+)\((?<scope>deps(-dev)?)\):', group = "<!-- 25 -->⬆️ Dependencies" },
{ message = "^feat", group = "<!-- 10 -->✨ Features" },
{ message = "^fix", group = "<!-- 20 -->🐛 Bug Fixes" },
{ message = "^perf", group = "<!-- 30 -->⚡ Performance Improvements" },
{ message = "^revert", group = "<!-- 40 -->⏪ Reverts" },
{ message = "^docs", group = "<!-- 50 -->📝 Documentation" },
{ message = "^style", group = "<!-- 60 -->💄 Styles" },
{ message = "^chore", group = "🎫 Miscellaneous Chores", skip = true },
{ message = "^refactor", group = "<!-- 70 -->♻ Code Refactoring" },
{ message = "^test", group = "<!-- 80 -->✅ Tests" },
{ message = "^build", group = "<!-- 90 -->👷 Build System" },
{ message = "^ci", group = "<!-- 95 -->🔧 Continuous Integration" },
]
protect_breaking_commits = true
filter_commits = false
topo_order = true
sort_commits = "newest"