build(cliff): add a new way to sort the commit groups (#1592)

This commit is contained in:
Pieter Willekens 2023-11-06 20:13:41 +01:00 committed by GitHub
parent af547b35fe
commit 3666e294e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1148 additions and 1120 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,11 +9,11 @@ header = """
# https://tera.netlify.app/docs/#introduction
body = """
{% for group, commits in commits | group_by(attribute="group") %}\
### {{ group | split(pat="$") | last | upper_first }}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
- **{{commit.scope}}**: {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\
- **{{commit.scope}}**: {{ commit.message | upper_first | trim }}\
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}
@ -23,7 +23,7 @@ body = """
{%- if commit.scope -%}
{% else -%}
{% raw %}\n{% endraw %}\
- {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\
- {{ commit.message | upper_first | trim }}\
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}
@ -39,6 +39,12 @@ trim = true
footer = """
"""
# postprocessors
postprocessors = [
{ pattern = '<REPO>', replace = "https://github.com/mainsail-crew/mainsail" }, # replace repository URL
]
[git]
# allow only conventional commits
# https://www.conventionalcommits.org
@ -46,21 +52,29 @@ conventional_commits = true
filter_unconventional = true
# regex for parsing and grouping commits
commit_parsers = [
# Commits to skip
{ message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits
{ message = "^chore\\(changelog\\): update changelog", group = "Changelog", skip = true}, # Old redundant commits
{ message = "^chore: push version number to", group = "9$Other", skip = true}, # Old redundant commits
{ message = "^feat(\\(.*\\))?:", group = "1$Features"},
{ message = "^feature(\\(.*\\))?:", group = "1$Features"},
{ message = "^fix(\\(.*\\))?:", group = "2$Bug Fixes and Improvements"},
{ message = "^docs(\\(.*\\))?:", group = "7$Documentation"},
{ message = "^perf(\\(.*\\))?:", group = "3$Performance"},
{ message = "^refactor(\\(.*\\))?:", group = "4$Refactor"},
{ message = "^style(\\(.*\\))?:", group = "5$Styling"},
{ message = "^test(\\(.*\\))?:", group = "9$Other"},
{ message = "^locale(\\(.*\\))?:", group = "6$Localization"},
{ message = "^chore(\\(.*\\))?:", group = "9$Other"},
{ message = "^chore\\(changelog\\): update changelog", group = "Changelog", skip = true}, # Old redundant commits
# Commits to parse
{ message = "^feat(\\(.*\\))?:", group = "<!-- 1 -->Features"},
{ message = "^feature(\\(.*\\))?:", group = "<!-- 1 -->Features"},
{ message = "^fix(\\(.*\\))?:", group = "<!-- 2 -->Bug Fixes and Improvements"},
{ message = "^perf(\\(.*\\))?:", group = "<!-- 3 -->Performance"},
{ message = "^refactor(\\(.*\\))?:", group = "<!-- 4 -->Refactor"},
{ message = "^style(\\(.*\\))?:", group = "<!-- 5 -->Styling"},
{ message = "^locale(\\(.*\\))?:", group = "<!-- 6 -->Localization"},
{ message = "^docs(\\(.*\\))?:", group = "<!-- 7 -->Documentation"},
{ message = "^test(\\(.*\\))?:", group = "<!-- 8 -->Other"},
{ message = "^chore(\\(.*\\))?:", group = "<!-- 8 -->Other"},
{ body = ".*security", group = "Security"},
]
commit_preprocessors = [
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/pull/${2}))" },
]
# filter out the commits that are not matched by commit parsers
filter_commits = true
ignore_tags="v*-(beta|rc)*"

View File

@ -17,11 +17,11 @@ body = """
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}\
### {{ group | split(pat="$") | last | upper_first }}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
- **{{commit.scope}}**: {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\
- **{{commit.scope}}**: {{ commit.message | upper_first | trim }}\
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}
@ -30,7 +30,7 @@ body = """
{%- if commit.scope -%}
{% else -%}
{% raw %}\n{% endraw %}\
- {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\
- {{ commit.message | upper_first | trim }}\
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}
@ -45,6 +45,11 @@ trim = true
footer = """
"""
# postprocessors
postprocessors = [
{ pattern = '<REPO>', replace = "https://github.com/mainsail-crew/mainsail" }, # replace repository URL
]
[git]
# allow only conventional commits
# https://www.conventionalcommits.org
@ -52,21 +57,30 @@ conventional_commits = true
filter_unconventional = false
# regex for parsing and grouping commits
commit_parsers = [
# Commits to skip
{ message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits
{ message = "^chore\\(changelog\\): update changelog", group = "Changelog", skip = true}, # Old redundant commits
{ message = "^chore: push version number to", group = "9$Other", skip = true}, # Old redundant commits
{ message = "^feat(\\(.*\\))?:", group = "1$Features"},
{ message = "^feature(\\(.*\\))?:", group = "1$Features"},
{ message = "^fix(\\(.*\\))?:", group = "2$Bug Fixes and Improvements"},
{ message = "^docs(\\(.*\\))?:", group = "7$Documentation"},
{ message = "^perf(\\(.*\\))?:", group = "3$Performance"},
{ message = "^refactor(\\(.*\\))?:", group = "4$Refactor"},
{ message = "^style(\\(.*\\))?:", group = "5$Styling"},
{ message = "^test(\\(.*\\))?:", group = "9$Other"},
{ message = "^locale(\\(.*\\))?:", group = "6$Localization"},
{ message = "^chore(\\(.*\\))?:", group = "9$Other"},
{ body = ".*security", group = "Security"},
{ message = "^chore\\(changelog\\): update changelog", group = "Changelog", skip = true}, # Old redundant commits
# Commits to parse
{ message = "^feat(\\(.*\\))?:", group = "<!-- 1 -->Features"},
{ message = "^feature(\\(.*\\))?:", group = "<!-- 1 -->Features"},
{ message = "^fix(\\(.*\\))?:", group = "<!-- 2 -->Bug Fixes and Improvements"},
{ message = "^perf(\\(.*\\))?:", group = "<!-- 3 -->Performance"},
{ message = "^refactor(\\(.*\\))?:", group = "<!-- 4 -->Refactor"},
{ message = "^style(\\(.*\\))?:", group = "<!-- 5 -->Styling"},
{ message = "^locale(\\(.*\\))?:", group = "<!-- 6 -->Localization"},
{ message = "^docs(\\(.*\\))?:", group = "<!-- 7 -->Documentation"},
{ message = "^test(\\(.*\\))?:", group = "<!-- 8 -->Other"},
{ message = "^chore(\\(.*\\))?:", group = "<!-- 8 -->Other"},
{ message = "release v2.1.2", group = "Release"}, # workaround for v2.1.2 release
{ body = ".*security", group = "Security"},
]
commit_preprocessors = [
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/pull/${2}))" },
]
# filter out the commits that are not matched by commit parsers
filter_commits = true