# git-cliff configuration file

[changelog]
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% if version %}\
    ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
    ## [unreleased]
{% endif %}\
{% set_global group_order = ["Features", "Bug Fixes", "Performance", "Refactoring", "Documentation", "Styling", "Testing", "Build", "CI", "Miscellaneous Tasks", "Security"] %}\
{% for group_name in group_order %}\
{% set commits_in_group = commits | filter(attribute="group", value=group_name) %}\
{% if commits_in_group | length > 0 %}\
    ### {{ group_name }}
    {% for commit in commits_in_group %}\
    - {{ commit.message | split(pat="\n") | first | trim | upper_first }}
    {% endfor %}\
{% endif %}\
{% endfor %}\
{% set other_commits = commits | filter(attribute="group", value="Other") %}\
{% if other_commits | length > 0 %}\
    {% for commit in other_commits %}\
    - {{ commit.message | split(pat="\n") | first | trim | upper_first }}
    {% endfor %}\
{% endif %}\n
"""
# remove leading and trailing whitespace from the template
trim = true

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = false
# process each line of a commit as an individual commit
split_commits = false
# regex for parsing and grouping commits
commit_parsers = [
    { message = "^Merge pull request", skip = true },
    { message = "^Merge branch", skip = true },
    { message = "^feat", group = "Features" },
    { message = "^fix", group = "Bug Fixes" },
    { message = "^doc", group = "Documentation" },
    { message = "^perf", group = "Performance" },
    { message = "^refactor", group = "Refactoring" },
    { message = "^style", group = "Styling" },
    { message = "^test", group = "Testing" },
    { message = "^build", group = "Build" },
    { message = "^ci", group = "CI" },
    { message = "^chore\\(release\\): prepare for", skip = true },
    { message = "^chore: release", skip = true },
    { message = "^Release ", skip = true },
    { message = "^chore", group = "Miscellaneous Tasks" },
    { body = ".*security", group = "Security" },
    { message = ".*", group = "Other" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
