# git-cliff configuration — renders GitHub Release notes from Conventional Commits.
# https://git-cliff.org/docs/configuration

[changelog]
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).

"""

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 | striptags | trim | upper_first }}

    {% for commit in commits %}\
        - {% if commit.scope %}**{{ commit.scope }}**: {% endif %}\
            {% if commit.breaking %}[**BREAKING**] {% endif %}\
            {{ commit.message | upper_first | trim }}\
            {% if commit.remote.pr_number %} \
                ([#{{ commit.remote.pr_number }}](https://github.com/sunerpy/scaffold-gen/pull/{{ commit.remote.pr_number }}))\
            {% endif %}
    {% endfor %}
{% endfor %}
"""

footer = """
---
*Generated by [git-cliff](https://github.com/orhun/git-cliff)*
"""

trim = true

[git]
conventional_commits = true
filter_unconventional = true
split_commits = false

commit_preprocessors = [
  { pattern = '\(#([0-9]+)\)', replace = "([#${1}](https://github.com/sunerpy/scaffold-gen/issues/${1}))" },
  { pattern = '  +', replace = " " },
]

commit_parsers = [
  { message = "^feat", group = "Features" },
  { message = "^fix", group = "Bug Fixes" },
  { message = "^docs?", group = "Documentation" },
  { message = "^perf", group = "Performance" },
  { message = "^refactor", group = "Refactor" },
  { message = "^style", group = "Styling" },
  { message = "^test", group = "Testing" },
  { message = "^build", group = "Build" },
  { message = "^ci", group = "CI/CD" },
  { message = "^chore\\(release\\)", skip = true },
  { message = "^chore\\(changelog\\)", skip = true },
  { message = "^chore: (release|bump|update changelog)", skip = true },
  { message = "^deps", group = "Dependencies" },
  { message = "^chore", group = "Miscellaneous" },
  { body = ".*security", group = "Security" },
]

protect_breaking_commits = false
filter_commits = false
tag_pattern = "v[0-9].*"
skip_tags = "v0.0.0"
topo_order = false
sort_commits = "oldest"
