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

[remote.github]
owner = "pocket-id"
repo = "pocket-id"

[git]
conventional_commits = true
filter_unconventional = true
commit_preprocessors = [{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" }]
commit_parsers = [
        { message = "^feat", group = "Features" },
        { message = "^fix", group = "Bug Fixes" },
        { message = "^docs", group = "Documentation" },
        { message = "^perf", group = "Performance Improvements" },
        { message = "^release", skip = true },
        { message = "update translations via Crowdin", skip = true },
        { message = ".*", group = "Other", default_scope = "other"},
]
filter_commits = false

[changelog]
trim = true
body = """
## {{ version | default(value="Unknown Version") }}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | title }}
{% for commit in commits %}
  - {{ commit.message | trim }} \
    {%- if commit.remote.pr_number %} ([#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) by @{{ commit.remote.username | default(value=commit.author.name) }}){%- else %} ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}) by @{{ commit.remote.username | default(value=commit.author.name) }}){%- endif -%}
{% endfor %}
{% endfor %}
{% if version -%}
    {% if previous.version -%}
      **Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}
    {% endif %}
{% else -%}
  {% raw %}\n{% endraw %}
{% endif %}

{%- macro remote_url() -%}
  https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
"""