# git-cliff configuration — generates CHANGELOG.md from conventional commits.
# Output follows the Keep a Changelog format (https://keepachangelog.com/en/1.1.0/).
# See https://git-cliff.org/docs/configuration

[changelog]
header = """
# Changelog

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

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
"""
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 %}
        - {{ commit.message | split(pat="\n") | first | upper_first | trim }}\
    {% endfor %}
{% endfor %}\n
"""
footer = ""
# Remove leading and trailing whitespaces from the changelog's body.
trim = true

[git]
# Parse commits according to the conventional commits specification.
conventional_commits = true
# Drop commits that are not conventional (e.g. merge commits).
filter_unconventional = true
# Drop commits that no parser assigns to a group.
filter_commits = true
# Only consider tags that look like releases (v1.5, v1.6, ...).
tag_pattern = "v[0-9]*"
sort_commits = "oldest"
# Groups render alphabetically; "Added" < "Changed" < "Fixed" already matches
# the Keep a Changelog ordering for the types we emit.
commit_parsers = [
  { message = "^feat", group = "Added" },
  { message = "^fix", group = "Fixed" },
  { message = "^refactor", group = "Changed" },
  { message = "^perf", group = "Changed" },
  { message = "^docs", group = "Changed" },
  { message = "^chore", skip = true },
  { message = "^test", skip = true },
  { message = "^style", skip = true },
  { message = "^ci", skip = true },
  { message = "^build", skip = true },
]
