-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathcliff.toml
More file actions
94 lines (86 loc) · 3.09 KB
/
cliff.toml
File metadata and controls
94 lines (86 loc) · 3.09 KB
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
[remote.github]
owner = "erikjuhani"
repo = "basalt"
[changelog]
header = """
# Changelog
"""
body = """
{%- if commits | length > 0 -%}
{%- if version %}
## [{{ version | split(pat="/") | last }}]({{ self::remote_url() }}/releases/tag/{{ version }}) ({{ timestamp | date(format="%b, %d %Y") }})
{% endif -%}
{%- endif -%}
{% macro commit(commit) -%}
- [{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}) \
{{ commit.message | split(pat="\n") | first | upper_first | trim }}
{%- set lines = commit.message | split(pat="\n") | slice(start=1) -%}
{%- set body_lines = [] -%}
{%- set trailers = [] -%}
{%- for line in lines -%}
{%- if line is starting_with("Signed-off-by:") or line is starting_with("Co-authored-by:") -%}
{%- set_global trailers = trailers | concat(with=line) -%}
{%- elif line is matching("^[A-Za-z-]+: .+") -%}
{# Skip other trailers - don't add them to body_lines #}
{%- else -%}
{%- set_global body_lines = body_lines | concat(with=line) -%}
{%- endif -%}
{%- endfor -%}
{%- set commit_body = body_lines | join(sep="\n") | trim -%}
{% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif -%}\
{% if commit.remote.pr_number %} in [#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}){%- endif %}\
{%- if commit.breaking %} [**breaking**]{% endif %}
{% if commit_body %}
{%- for line in commit_body | split(pat="\n") %}
{%- if line | trim %}
> {{ line }}
{%- else %}
>
{%- endif %}
{%- endfor %}
{%- endif %}
{%- if trailers | length > 0 %}
>
{%- for trailer in trailers %}
{{ trailer | indent(prefix="> ", first=true, blank=true) }}
{%- endfor %}
{%- endif %}
{% endmacro -%}
{%- if commits | length > 0 -%}
{% 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::commit(commit=commit) }}
{%- endfor -%}
{% for commit in commits %}
{%- if not commit.scope %}
{{ self::commit(commit=commit) }}
{%- endif -%}
{%- endfor -%}
{%- endfor %}
{%- endif -%}
{%- macro remote_url() -%}
{%- if remote.owner -%}
https://github.com/{{ remote.owner }}/{{ remote.repo }}\
{%- else -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
{%- endif -%}
{% endmacro %}
"""
trim = true
[git]
conventional_commits = false
commit_parsers = [
{ message = "Changelog: breaking", group = "Breaking" },
{ message = "Changelog: added", group = "Added" },
{ message = "Changelog: changed", group = "Changed" },
{ message = "Changelog: deprecated", group = "Deprecated" },
{ message = "Changelog: removed", group = "Removed" },
{ message = "Changelog: fixed", group = "Fixed" },
{ message = "Changelog: security", group = "Security" },
{ message = "Changelog: dependencies", group = "Dependencies" },
{ field = "author.name", pattern = "renovate-updater|dependabot", group = "Dependencies" },
{ message = "^Merge pull request", skip = true },
{ message = "^Merge branch", skip = true },
]
filter_commits = true