From 7e41adf00bb93cf6e016b9a7cd8ebdc693666077 Mon Sep 17 00:00:00 2001 From: Christian Heusel Date: Sat, 22 Jul 2023 10:40:34 +0200 Subject: chore: add a config file for git cliff This is done so that the generated changelog carries more information (i.e. the scope of the change). Co-Authored-by: Levente Polyak Signed-off-by: Christian Heusel Signed-off-by: Levente Polyak --- cliff.toml | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 cliff.toml (limited to 'cliff.toml') diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..597d778 --- /dev/null +++ b/cliff.toml @@ -0,0 +1,44 @@ +[changelog] +header = "# Changelog\n\n" +body = """ +{%- if version -%} + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{%- else -%} + ## [unreleased] +{%- endif %} +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | upper_first }} + {% for commit in commits | sort(attribute="message") %} + - {% set component = commit.footers | filter(attribute="token", value="Component") | map(attribute="value") | join %} + {%- if component %}{{ component }}: {% elif commit.scope %}{{ commit.scope }}: {% endif %} + {{- commit.message | upper_first }} + {%- set fixes = commit.footers | filter(attribute="token", value="Fixes") %} + {%- for fix in fixes %}{{ fix.separator }}{{ fix.value }}{% endfor %} + {%- endfor %} +{% endfor %} + +""" +footer = "" + +# remove the leading and trailing whitespaces from the template +trim = true + +[git] +# allow only conventional commits +# https://www.conventionalcommits.org +conventional_commits = true +# regex for parsing and grouping commits +commit_parsers = [ + { message = "^chore\\(release\\): version", skip = true}, + { message = "^feat", group = "Features"}, + { message = "^fix", group = "Bug Fixes"}, + { message = "^doc", group = "Documentation"}, + { message = "^perf", group = "Performance"}, + { message = "^test", group = "Testing"}, + { message = "^chore", group = "Miscellaneous Tasks"}, + { body = ".*security", group = "Security"}, +] +# filter out the commits that are not matched by commit parsers +filter_commits = false +# glob pattern for matching git tags +tag_pattern = "*v[0-9]*" -- cgit v1.2.3-54-g00ecf From 4d7364ed1b893ba8498cf5a46b82413079b1131d Mon Sep 17 00:00:00 2001 From: Orhun Parmaksız Date: Tue, 31 Oct 2023 16:55:14 +0100 Subject: fix(cliff): update the tag_pattern to use regex --- cliff.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cliff.toml') diff --git a/cliff.toml b/cliff.toml index 597d778..ab01a6b 100644 --- a/cliff.toml +++ b/cliff.toml @@ -40,5 +40,5 @@ commit_parsers = [ ] # filter out the commits that are not matched by commit parsers filter_commits = false -# glob pattern for matching git tags -tag_pattern = "*v[0-9]*" +# regex for matching git tags +tag_pattern = "^v[0-9]+\\.[0-9]+\\.[0-9]+.*" -- cgit v1.2.3-54-g00ecf From b7984c6073f07d06896dc5cfbe38cbbd563b078f Mon Sep 17 00:00:00 2001 From: Christian Heusel Date: Sun, 22 Oct 2023 20:37:09 +0200 Subject: chore(release): allow fixes tags without cluttering the changelog Signed-off-by: Christian Heusel --- cliff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cliff.toml') diff --git a/cliff.toml b/cliff.toml index ab01a6b..1dcfe92 100644 --- a/cliff.toml +++ b/cliff.toml @@ -13,7 +13,7 @@ body = """ {%- if component %}{{ component }}: {% elif commit.scope %}{{ commit.scope }}: {% endif %} {{- commit.message | upper_first }} {%- set fixes = commit.footers | filter(attribute="token", value="Fixes") %} - {%- for fix in fixes %}{{ fix.separator }}{{ fix.value }}{% endfor %} + {%- for fix in fixes %}{% if fix.separator == '#' %}{{ fix.separator }}{{ fix.value }}{% endif %}{% endfor %} {%- endfor %} {% endfor %} -- cgit v1.2.3-54-g00ecf From 9f8ca5df1a0272bfc1da30d46c4497245cbde417 Mon Sep 17 00:00:00 2001 From: Christian Heusel Date: Fri, 24 Nov 2023 02:32:02 +0100 Subject: chore(release): nicely format multiple "Component:" trailers Signed-off-by: Christian Heusel --- cliff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cliff.toml') diff --git a/cliff.toml b/cliff.toml index 1dcfe92..9ffaa9e 100644 --- a/cliff.toml +++ b/cliff.toml @@ -9,7 +9,7 @@ body = """ {% for group, commits in commits | group_by(attribute="group") %} ### {{ group | upper_first }} {% for commit in commits | sort(attribute="message") %} - - {% set component = commit.footers | filter(attribute="token", value="Component") | map(attribute="value") | join %} + - {% set component = commit.footers | filter(attribute="token", value="Component") | map(attribute="value") | join(sep=", ") %} {%- if component %}{{ component }}: {% elif commit.scope %}{{ commit.scope }}: {% endif %} {{- commit.message | upper_first }} {%- set fixes = commit.footers | filter(attribute="token", value="Fixes") %} -- cgit v1.2.3-54-g00ecf From 0f14d630bce17ddb2d6020b611705ce5f2a4e802 Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Tue, 19 Dec 2023 19:53:09 +0100 Subject: feat(cliff): add label for breaking changes to changelog --- cliff.toml | 1 + 1 file changed, 1 insertion(+) (limited to 'cliff.toml') diff --git a/cliff.toml b/cliff.toml index 9ffaa9e..8a6c843 100644 --- a/cliff.toml +++ b/cliff.toml @@ -12,6 +12,7 @@ body = """ - {% set component = commit.footers | filter(attribute="token", value="Component") | map(attribute="value") | join(sep=", ") %} {%- if component %}{{ component }}: {% elif commit.scope %}{{ commit.scope }}: {% endif %} {{- commit.message | upper_first }} + {%- if commit.breaking %} (breaking){% endif %} {%- set fixes = commit.footers | filter(attribute="token", value="Fixes") %} {%- for fix in fixes %}{% if fix.separator == '#' %}{{ fix.separator }}{{ fix.value }}{% endif %}{% endfor %} {%- endfor %} -- cgit v1.2.3-54-g00ecf From 3933f200018e205ee12b0307d583c96d559ff3cf Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Tue, 19 Dec 2023 19:54:01 +0100 Subject: fix(cliff): trim fix separator before checking merge request id The fix separator contains a whitespace, which made the check never match. We now trim the separator before checking, making it resilient against any kind of spaces. Fixes b7984c6073f07d06896dc5cfbe38cbbd563b078f --- cliff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cliff.toml') diff --git a/cliff.toml b/cliff.toml index 8a6c843..2ec492c 100644 --- a/cliff.toml +++ b/cliff.toml @@ -14,7 +14,7 @@ body = """ {{- commit.message | upper_first }} {%- if commit.breaking %} (breaking){% endif %} {%- set fixes = commit.footers | filter(attribute="token", value="Fixes") %} - {%- for fix in fixes %}{% if fix.separator == '#' %}{{ fix.separator }}{{ fix.value }}{% endif %}{% endfor %} + {%- for fix in fixes %}{% if fix.separator|trim == '#' %}{{ fix.separator }}{{ fix.value }}{% endif %}{% endfor %} {%- endfor %} {% endfor %} -- cgit v1.2.3-54-g00ecf