# git-cliff configuration file
# https://git-cliff.org/docs/configuration

[changelog]
# Changelog header
header = """
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

"""
# Template for the changelog body
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 %}
        - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/darjus/embellama/commit/{{ commit.id }}))
    {%- endfor %}
{% endfor %}\n
"""
# Remove the leading and trailing whitespace from the template
trim = true
# Footer template for the changelog
footer = """
<!-- generated by git-cliff -->
"""

[git]
# Parse the commits based on conventional commit specification
conventional_commits = true
# Filter out commits that are not conventional
filter_unconventional = false
# Process each line of a commit as an individual commit
split_commits = false
# Regex for preprocessing the commit messages
commit_preprocessors = [
    # Replace issue numbers
    { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/darjus/embellama/issues/${2}))" },
]
# Regex for parsing and grouping commits
commit_parsers = [
    { 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 = "^chore\\(release\\): prepare for", skip = true },
    { message = "^chore\\(deps\\)", skip = true },
    { message = "^chore\\(pr\\)", skip = true },
    { message = "^chore\\(pull\\)", skip = true },
    { message = "^chore", group = "Miscellaneous Tasks" },
    { body = ".*security", group = "Security" },
    { message = "^revert", group = "Revert" },
]
# 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
# Glob pattern for matching git tags
tag_pattern = "v[0-9]*"
# Regex for skipping tags
skip_tags = ""
# Regex for ignoring tags
ignore_tags = ""
# Sort the tags topologically
topo_order = false
# Sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
