-
Notifications
You must be signed in to change notification settings - Fork 15
/
deephaven-changelog-template
54 lines (49 loc) · 2.48 KB
/
deephaven-changelog-template
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
{# Tera templates are used to generate the changelog content -#}
{# https://keats.github.io/tera/docs/ -#}
{# Based on Cocogittos remote template, but adds breaking changes: https://github.com/cocogitto/cocogitto/blob/main/src/conventional/changelog/template/remote -#}
{# First display all the breaking changes -#}
{% set breaking_commits = commits | filter(attribute="breaking_change", value=true) -%}
{% if breaking_commits | length > 0 -%}
#### ⚠ Breaking Changes
{% for commit in breaking_commits -%}
{% set commit_link = repository_url ~ "/commit/" ~ commit.id -%}
{% set shorthand = commit.id | truncate(length=7, end="") -%}
{% for footer in commit.footer | filter(attribute="token", value="BREAKING CHANGE") -%}
- {{ footer.content }} - ([{{shorthand}}]({{ commit_link }}))
{% endfor -%}
{% endfor -%}
{% endif %}
{# Now group the rest of the commits and display them -#}
{% set typed_commit_map = commits | group_by(attribute="type") -%}
{% set type_order = ["Features", "Bug Fixes", "Performance Improvements", "Miscellaneous Chores", "Documentation", "Refactoring", "Build system", "Style"] -%}
{% for type in type_order -%}
{% if typed_commit_map[type] -%}
#### {{ type | upper_first }}
{% for scope, scoped_commits in typed_commit_map[type] | group_by(attribute="scope") -%}
{% for commit in scoped_commits | sort(attribute="scope") -%}
{% if commit.author and repository_url -%}
{% set author = "@" ~ commit.author -%}
{% set author_link = platform ~ "/" ~ commit.author -%}
{% set author = "[" ~ author ~ "](" ~ author_link ~ ")" -%}
{% else -%}
{% set author = commit.signature -%}
{% endif -%}
{% set commit_link = repository_url ~ "/commit/" ~ commit.id -%}
{% set shorthand = commit.id | truncate(length=7, end="") -%}
- **({{ scope }})** {{ commit.summary }} - ([{{shorthand}}]({{ commit_link }})) - {{ author }}
{% endfor -%}
{% endfor -%}
{% for commit in typed_commit_map[type] | unscoped -%}
{% if commit.author and repository_url -%}
{% set author = "@" ~ commit.author -%}
{% set author_link = platform ~ "/" ~ commit.author -%}
{% set author = "[" ~ author ~ "](" ~ author_link ~ ")" -%}
{% else -%}
{% set author = commit.signature -%}
{% endif -%}
{% set commit_link = repository_url ~ "/commit/" ~ commit.id -%}
{% set shorthand = commit.id | truncate(length=7, end="") -%}
- {{ commit.summary }} - ([{{shorthand}}]({{ commit_link }})) - {{ author }}
{% endfor -%}
{% endif %}
{% endfor -%}