@@ -11,7 +11,6 @@ repo = "yasumi"
1111
1212[changelog ]
1313
14- # changelog header
1514header = """
1615# Changelog\n
1716All notable changes to this project will be documented in this file.
@@ -23,21 +22,19 @@ Changes related to the logic of the holidays or their providers are listed first
2322followed by any architectural or technical changes.\n
2423"""
2524
26- # template for the changelog body
27- # https://keats.github.io/tera/docs/#introduction
2825body = """
2926{% if version -%}
3027 ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
3128{% else -%}
32- ## [Unreleased ]
29+ ## [unreleased ]
3330{% endif -%}
3431
3532{% for group, commits in commits | unique(attribute="message") | filter(attribute="merge_commit", value=false) | group_by(attribute="group") %}
3633 ### {{ group | striptags | trim | upper_first }}
3734 {% for commit in commits %}
38- - {% if commit.scope %}({{ commit.scope | upper_first }}) {% endif%}{{ commit.message | split(pat="\n ") | first | split(pat=": ") | last | trim | upper_first }}\
39- {% endfor %}
40- {% endfor %}
35+ - {% if commit.scope %}({{ commit.scope | upper_first }}) {% endif%}{{ commit.message | split(pat="\n ") | first | split(pat=": ") | last | trim | upper_first }}
36+ {%- endfor %}
37+ {% endfor %}\n
4138
4239{%- if github -%}
4340{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
@@ -49,43 +46,73 @@ body = """
4946{%- endif %}\n\n
5047"""
5148
52- # template for the changelog footer
5349footer = """
50+ {%- macro remote_url() -%}
51+ https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
52+ {%- endmacro -%}
53+
5454{% for release in releases -%}
5555 {% if release.version -%}
5656 {% if release.previous.version -%}
5757 [{{ release.version | trim_start_matches(pat="v") }}]: \
58- https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
59- /compare/{{ release.previous.version }}..{{ release.version }}
58+ {{ self::remote_url() }}/compare/{{ release.previous.version }}..{{ release.version }}
6059 {% endif -%}
6160 {% else -%}
62- [unreleased]: https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
63- /compare/{{ release.previous.version }}..HEAD
61+ [unreleased]: {{ self::remote_url() }}/compare/{{ release.previous.version }}..HEAD
6462 {% endif -%}
6563{% endfor %}
6664"""
6765
68- # remove the leading and trailing whitespace from the templates
66+ # Remove leading and trailing whitespaces from the changelog's body.
6967trim = true
7068
69+ # An array of regex based postprocessors to modify the changelog.
70+ postprocessors = [
71+ # Replace the placeholder `<REPO>` with a URL.
72+ { pattern = ' <REPO>' , replace = " https://github.com/azuyalabs/yasumi" }, # replace repository URL
73+ ]
74+
7175[git ]
7276
73- # parse the commits based on https://www.conventionalcommits.org
77+ # Parse commits according to the conventional commits specification.
78+ # See https://www.conventionalcommits.org
7479conventional_commits = true
7580
76- # filter out the commits that are not conventional
81+ # Exclude commits that do not match the conventional commits specification.
7782filter_unconventional = true
7883
79- # process each line of a commit as an individual commit
84+ # Split commits on newlines, treating each line as an individual commit.
8085split_commits = false
8186
82- # preprocessors for manipulating the commit messages before parsing/grouping them
87+ # An array of regex based parsers to modify commit messages prior to further processing.
8388commit_preprocessors = [
84- { pattern = " \\ (#([0-9]+)\\ )" , replace = " ([#${1}](https://github.com/azuyalabs/yasumi/issues/${1}))" }
89+ { pattern = " \\ (#([0-9]+)\\ )" , replace = " ([#${1}](<REPO>/issues/${1}))" },
90+
91+ # Check spelling of the commit message using https://github.com/crate-ci/typos.
92+ # If the spelling is incorrect, it will be fixed automatically.
93+ { pattern = ' .*' , replace_command = ' typos --write-changes -' }
8594]
8695
87- # regex for parsing and grouping commits
96+ # An array of regex based parsers for extracting data from the commit message.
97+ # Assigns commits to groups.
98+ # Optionally sets the commit's scope and can decide to exclude commits from further processing.
8899commit_parsers = [
100+ # skip commits related to composer (e.g. package updates)
101+ { message = " ^chore\\ (composer\\ )" , skip = true },
102+ { message = " .*dependencies" , skip = true },
103+
104+ # skip commits related to fixes of code style issues
105+ { message = " ^chore\\ (style\\ )" , skip = true },
106+
107+ { message = " ^docs:.*copyright" , skip = true },
108+
109+ { message = " ^chore\\ (changelog\\ )" , skip = true },
110+ { message = " ^chore\\ (readme\\ )" , skip = true },
111+ { message = " ^chore\\ (release\\ ): prepare for" , skip = true },
112+
113+ # skip merge commits
114+ { message = " ^[Mm]erge" , skip = true },
115+
89116 { message = " ^feat" , group = " <!-- 0 -->Features" },
90117 { message = " ^fix" , group = " <!-- 1 -->Fixes" },
91118 { message = " ^refactor" , group = " <!-- 2 -->Refactor" },
@@ -94,28 +121,28 @@ commit_parsers = [
94121 { message = " ^style" , group = " <!-- 5 -->Code Style" },
95122 { message = " ^test" , group = " <!-- 6 -->Testing" },
96123 { message = " ^chore|^ci|^build" , group = " <!-- 7 -->Other" },
97-
98- # skip merge commits
99- { message = " ^[Mm]erge" , skip = true },
100124]
101125
102- # protect breaking changes from being skipped due to matching a skipping commit_parser
126+ # Prevent commits that are breaking from being excluded by commit parsers.
103127protect_breaking_commits = false
104128
105- # filter out the commits that are not matched by commit parsers
129+ # Exclude commits that are not matched by any commit parser.
106130filter_commits = true
107131
108- # regex for matching git tags
132+ # Regex to select git tags that represent releases.
109133tag_pattern = " [0-9].*"
110134
111- # regex for skipping tags
135+ # Regex to select git tags that do not represent proper releases.
136+ # Takes precedence over `tag_pattern`.
137+ # Changes belonging to these releases will be included in the next release.
112138skip_tags = " beta|alpha"
113139
114- # regex for ignoring tags
140+ # Regex to exclude git tags after applying the tag_pattern.
115141ignore_tags = " "
116142
117- # sort the tags topologically
118- topo_order = true
143+ # Order releases topologically instead of chronologically.
144+ topo_order = false
119145
120- # sort the commits inside sections by oldest/newest order
146+ # Order of commits in each group/release within the changelog.
147+ # Allowed values: newest, oldest
121148sort_commits = " newest"
0 commit comments