Skip to content

Commit d306cb4

Browse files
committed
chore: fix broken cliff.
1 parent c664487 commit d306cb4

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

cliff.toml

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# changelog header
1010
header = """
1111
# Changelog\n
12-
All notable changes to this project will be documented in this file.\n
1312
Acronyms:
1413
- LB: lab-report (实验报告模板)
1514
- GT: graduate-thesis (研究生学位论文模板)
@@ -23,25 +22,38 @@ Acronyms:
2322
# template for the changelog body
2423
# https://keats.github.io/tera/docs/#introduction
2524
body = """
25+
{%- macro remote_url() -%}
26+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
27+
{%- endmacro -%}
28+
2629
{% if version %}\
2730
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
2831
{% else %}\
2932
## [unreleased]
3033
{% endif %}\
31-
{% if previous %}\
32-
{% if previous.commit_id %}
33-
[{{ previous.commit_id | truncate(length=7, end="") }}](https://github.com/BITNP/BIThesis/commit/{{ previous.commit_id }})...\
34-
[{{ commit_id | truncate(length=7, end="") }}](https://github.com/BITNP/BIThesis/commit/{{ commit_id }})
35-
{% endif %}\
36-
{% endif %}\
37-
{% for group, commits in commits | group_by(attribute="group") %}
38-
### {{ group | striptags | trim | upper_first }}
39-
{% for commit in commits %}
34+
{% for group, commits in commits | unique(attribute="id") | group_by(attribute="group") %}
35+
### {{ group | upper_first }}
36+
{% for commit in commits | unique(attribute="message") %}
4037
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
4138
{% if commit.breaking %}[**breaking**] {% endif %}\
4239
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/BITNP/BIThesis/commit/{{ commit.id }}))\
40+
{% if commit.github.username %} by @{{ commit.github.username }}{%- endif -%}
41+
{% if commit.github.pr_number %} in \
42+
[#{{ commit.github.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.github.pr_number }}) \
43+
{%- endif -%}
4344
{% endfor %}
4445
{% endfor %}\n
46+
47+
{%- if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
48+
## New Contributors
49+
{%- endif -%}
50+
51+
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
52+
* @{{ contributor.username }} made their first contribution
53+
{%- if contributor.pr_number %} in \
54+
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
55+
{%- endif %}
56+
{%- endfor %}\n
4557
"""
4658
# template for the changelog footer
4759
footer = """
@@ -59,7 +71,7 @@ conventional_commits = true
5971
# filter out the commits that are not conventional
6072
filter_unconventional = true
6173
# process each line of a commit as an individual commit
62-
split_commits = false
74+
split_commits = true
6375
# regex for preprocessing the commit messages
6476
commit_preprocessors = [
6577
# Replace issue numbers
@@ -102,3 +114,7 @@ topo_order = false
102114
sort_commits = "oldest"
103115
# limit the number of commits included in the changelog.
104116
# limit_commits = 42
117+
118+
[remote.github]
119+
owner = "BITNP"
120+
repo = "BIThesis"

0 commit comments

Comments
 (0)