|
| 1 | +# git-cliff ~ configuration file |
| 2 | +# https://git-cliff.org/docs/configuration |
| 3 | + |
| 4 | +[changelog] |
| 5 | +# A Tera template to be rendered as the changelog's header. |
| 6 | +# See https://keats.github.io/tera/docs/#introduction |
| 7 | +header = """ |
| 8 | +## What's Changed |
| 9 | +""" |
| 10 | +# A Tera template to be rendered for each release in the changelog. |
| 11 | +# See https://keats.github.io/tera/docs/#introduction |
| 12 | +body = """ |
| 13 | +{%- macro remote_url() -%} |
| 14 | + https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} |
| 15 | +{%- endmacro -%} |
| 16 | +
|
| 17 | +{% for group, commits in commits | group_by(attribute="group") %} |
| 18 | + ### {{ group | striptags | trim | upper_first }} |
| 19 | + {%- for commit in commits %} |
| 20 | + - {{ commit.message | split(pat="\n") | first | upper_first | trim }}\ |
| 21 | + {% if commit.remote.username and commit.remote.pr_number %} by @{{ commit.remote.username }}{%- endif -%} |
| 22 | + {% if commit.remote.pr_number %} in \ |
| 23 | + [#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) \ |
| 24 | + {%- endif -%} |
| 25 | + {% endfor %} |
| 26 | +{% endfor %} |
| 27 | +
|
| 28 | +{%- if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %} |
| 29 | + ## New Contributors |
| 30 | +{%- endif -%} |
| 31 | +
|
| 32 | +{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %} |
| 33 | + * @{{ contributor.username }} made their first contribution |
| 34 | + {%- if contributor.pr_number %} in \ |
| 35 | + [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \ |
| 36 | + {%- endif %} |
| 37 | +{%- endfor %}\n |
| 38 | +""" |
| 39 | +# A Tera template to be rendered as the changelog's footer. |
| 40 | +# See https://keats.github.io/tera/docs/#introduction |
| 41 | +footer = """ |
| 42 | +{%- macro remote_url() -%} |
| 43 | + https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} |
| 44 | +{%- endmacro -%} |
| 45 | +
|
| 46 | +{% for release in releases -%} |
| 47 | + {% if release.version -%} |
| 48 | + {% if release.previous.version -%} |
| 49 | + [{{ release.version | trim_start_matches(pat="v") }}]: \ |
| 50 | + {{ self::remote_url() }}/compare/{{ release.previous.version }}..{{ release.version }} |
| 51 | + {% endif -%} |
| 52 | + {% else -%} |
| 53 | + [unreleased]: {{ self::remote_url() }}/compare/{{ release.previous.version }}..HEAD |
| 54 | + {% endif -%} |
| 55 | +{% endfor %} |
| 56 | +""" |
| 57 | +# Remove leading and trailing whitespaces from the changelog's body. |
| 58 | +trim = true |
| 59 | + |
| 60 | +[git] |
| 61 | +# Parse commits according to the conventional commits specification. |
| 62 | +# See https://www.conventionalcommits.org |
| 63 | +conventional_commits = true |
| 64 | +# Exclude commits that do not match the conventional commits specification. |
| 65 | +filter_unconventional = true |
| 66 | +# An array of regex based parsers to modify commit messages prior to further processing. |
| 67 | +commit_preprocessors = [ |
| 68 | + # Remove issue numbers. |
| 69 | + { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" }, |
| 70 | +] |
| 71 | +# An array of regex based parsers for extracting data from the commit message. |
| 72 | +# Assigns commits to groups. |
| 73 | +# Optionally sets the commit's scope and can decide to exclude commits from further processing. |
| 74 | +commit_parsers = [ |
| 75 | + { message = "^feat", group = "<!-- 0 -->Features" }, |
| 76 | + { message = "^fix", group = "<!-- 1 -->Bug Fixes" }, |
| 77 | + { message = "^doc", group = "<!-- 3 -->Documentation" }, |
| 78 | + { message = "^perf", group = "<!-- 4 -->Performance" }, |
| 79 | + { message = "^refactor", group = "<!-- 2 -->Refactor" }, |
| 80 | + { message = "^style", group = "<!-- 5 -->Styling" }, |
| 81 | + { message = "^test", group = "<!-- 6 -->Testing" }, |
| 82 | + { message = "^chore\\(release\\): prepare for", skip = true }, |
| 83 | + { message = "^chore\\(deps.*\\)", skip = true }, |
| 84 | + { message = "^chore\\(pr\\)", skip = true }, |
| 85 | + { message = "^chore\\(pull\\)", skip = true }, |
| 86 | + { message = "^chore|^ci", group = "<!-- 7 -->Miscellaneous Tasks" }, |
| 87 | + { body = ".*security", group = "<!-- 8 -->Security" }, |
| 88 | + { message = "^revert", group = "<!-- 9 -->Revert" }, |
| 89 | + { message = ".*", group = "Other" }, |
| 90 | +] |
| 91 | +# Exclude commits that are not matched by any commit parser. |
| 92 | +filter_commits = false |
| 93 | +# Order releases topologically instead of chronologically. |
| 94 | +topo_order = false |
| 95 | +# Order of commits in each group/release within the changelog. |
| 96 | +# Allowed values: newest, oldest |
| 97 | +sort_commits = "newest" |
0 commit comments