|
| 1 | +# configuration file for git-cliff |
| 2 | + |
| 3 | +[changelog] |
| 4 | +trim = true # might have to be false to ensure ending on a new line. |
| 5 | + |
| 6 | +header = """ |
| 7 | +# Changelog |
| 8 | +
|
| 9 | +All notable changes to this project will be documented in this file. |
| 10 | +
|
| 11 | +The format is based on [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#specification), |
| 12 | +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
| 13 | +
|
| 14 | +""" |
| 15 | + |
| 16 | +body = """ |
| 17 | +{%- macro remote_url() -%} |
| 18 | + https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} |
| 19 | +{%- endmacro -%} |
| 20 | +
|
| 21 | +{% macro print_commit(commit) -%} |
| 22 | + - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ |
| 23 | + {% if commit.breaking %}[**breaking**] {% endif %}\ |
| 24 | + {{ commit.message | upper_first }} - \ |
| 25 | + ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\ |
| 26 | +{% endmacro -%} |
| 27 | +
|
| 28 | +{% if version %}\ |
| 29 | + {% if previous.version %}\ |
| 30 | + ## [{{ version | trim_start_matches(pat="v") }}]\ |
| 31 | + ({{ self::remote_url() }}/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }} |
| 32 | + {% else %}\ |
| 33 | + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} |
| 34 | + {% endif %}\ |
| 35 | +{% else %}\ |
| 36 | + ## [unreleased] |
| 37 | +{% endif %}\ |
| 38 | +
|
| 39 | +{% for group, commits in commits | group_by(attribute="group") %} |
| 40 | + ### {{ group | striptags | trim | upper_first }} |
| 41 | + {% for commit in commits |
| 42 | + | filter(attribute="scope") |
| 43 | + | sort(attribute="scope") %} |
| 44 | + {{ self::print_commit(commit=commit) }} |
| 45 | + {%- endfor %} |
| 46 | + {% for commit in commits %} |
| 47 | + {%- if not commit.scope -%} |
| 48 | + {{ self::print_commit(commit=commit) }} |
| 49 | + {% endif -%} |
| 50 | + {% endfor -%} |
| 51 | +{% endfor -%} |
| 52 | +{%- if github -%} |
| 53 | +{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %} |
| 54 | + ## New Contributors |
| 55 | +{% endif %}\ |
| 56 | +{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %} |
| 57 | + * @{{ contributor.username }} made their first contribution |
| 58 | + {%- if contributor.pr_number %} in \ |
| 59 | + [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \ |
| 60 | + {%- endif %} |
| 61 | +{%- endfor -%} |
| 62 | +{%- endif %} |
| 63 | +""" |
| 64 | + |
| 65 | +footer = """ |
| 66 | +
|
| 67 | +That is all, [go back to the top](#changelog). |
| 68 | +""" |
| 69 | + |
| 70 | +#// # An array of regex based postprocessors to modify the changelog. |
| 71 | +#// postprocessors = [ |
| 72 | +#// # Replace the placeholder `<REPO>` with a URL. |
| 73 | +#// { pattern = '<REPO>', replace = "https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}" }, # replace repository URL |
| 74 | +#// ] |
| 75 | + |
| 76 | +[bump] |
| 77 | +features_always_bump_minor = true |
| 78 | +breaking_always_bump_major = true |
| 79 | +custom_major_increment_regex = "major" |
| 80 | +custom_minor_increment_regex = "minor" |
| 81 | +initial_tag = "0.0.0" |
| 82 | + |
| 83 | +[git] |
| 84 | + |
| 85 | +# Parse commits according to the conventional commits specification. |
| 86 | +# See https://www.conventionalcommits.org |
| 87 | +conventional_commits = true |
| 88 | + |
| 89 | +# Exclude commits that do not match the conventional commits specification. |
| 90 | +filter_unconventional = true |
| 91 | + |
| 92 | +# If any unconventional commits are found, an error will be logged and changelog generation fails. |
| 93 | +require_conventional = true |
| 94 | + |
| 95 | +# Split commits on newlines, treating each line as an individual commit. |
| 96 | +split_commits = false |
| 97 | + |
| 98 | +#// # An array of regex based parsers to modify commit messages prior to further processing. |
| 99 | +#// commit_preprocessors = [ |
| 100 | +#// # Replace issue numbers with link templates to be updated in `changelog.postprocessors`. |
| 101 | +#// { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))" }, |
| 102 | +#// ] |
| 103 | + |
| 104 | +# Prevent commits that are breaking from being excluded by commit parsers. |
| 105 | +protect_breaking_commits = true |
| 106 | + |
| 107 | +# Exclude commits that are not matched by any commit parser. |
| 108 | +filter_commits = false |
| 109 | + |
| 110 | +# Regex to select git tags that represent releases. |
| 111 | +tag_pattern = "v[0-9].*" |
| 112 | + |
| 113 | +# Regex to select git tags that do not represent proper releases. |
| 114 | +# Takes precedence over `tag_pattern`. |
| 115 | +# Changes belonging to these releases will be included in the next release. |
| 116 | +skip_tags = "beta|alpha" |
| 117 | + |
| 118 | +# Regex to exclude git tags after applying the tag_pattern. |
| 119 | +# ignore_tags = "" |
| 120 | + |
| 121 | +# Order releases topologically instead of chronologically. |
| 122 | +topo_order = false |
| 123 | + |
| 124 | +# Order of commits in each group/release within the changelog. |
| 125 | +# Allowed values: newest, oldest |
| 126 | +sort_commits = "newest" |
| 127 | + |
| 128 | +# An array of regex based parsers for extracting data from the commit message. |
| 129 | +# Assigns commits to groups. |
| 130 | +# Optionally sets the commit's scope and can decide to exclude commits from further processing. |
| 131 | +commit_parsers = [ |
| 132 | + # feat: a new feature |
| 133 | + { group = "<!-- 00 --> New Features", message = "^feat.*:"}, |
| 134 | + # fix: fixed bugs |
| 135 | + { group = "<!-- 01 --> Bug Fixes", message = "^fix.*:" }, |
| 136 | + # perf: performance improvements |
| 137 | + { group = "<!-- 02 --> Performance Improvements", message = "perf.*:" }, |
| 138 | + # test: adding or updating tests |
| 139 | + { group = "<!-- 03 --> Code Quality", message = "test.*:" }, |
| 140 | + # revert: reverts a previous commit |
| 141 | + { group = "<!-- 04 --> Reverts", message = "^reverts.*:", skip = true }, |
| 142 | + # docs: added or improved Documentation |
| 143 | + { group = "<!-- 05 --> Documentation", message = "^docs.*:" }, |
| 144 | + # chore: maintenance tasks (build tools, CI, etc.) |
| 145 | + { group = "<!-- 06 --> General Maintenance", message = "chore.*:" }, |
| 146 | + # refactor: code change that neither fixes a bug nor adds a feature |
| 147 | + { group = "<!-- 07 --> Refactors", message = "refactor.*:", skip = true }, |
| 148 | + # deps: sometimes used for dependency changes |
| 149 | + { group = "<!-- 08 --> Dependency Changes", message = "^deps.*:" }, |
| 150 | + { group = "<!-- 08 --> Dependency Changes", message = "^chore\\(deps\\):" }, |
| 151 | + # ci: CI configuration or script changes |
| 152 | + { group = "<!-- 09 --> Automation", message = "^ci.*:" }, |
| 153 | + # style: formatting (whitespace, semicolons, etc.) — no code change |
| 154 | + { group = "<!-- 10 --> Stylistic Changes", message = "style.*:", skip = true }, |
| 155 | + # build: changes affecting the build system or dependencies |
| 156 | + { group = "<!-- 11 --> Build", message = "build.*:", skip = true }, |
| 157 | + # merge: merge commits (should be prevented) |
| 158 | + { group = "<!-- 12 --> Merges", message = "^[M|m]erge", skip = true }, |
| 159 | + # Unmentioned |
| 160 | + { group = "<!-- 13 --> Other", message = ".*", default_scope = "other"}, |
| 161 | +] |
0 commit comments