[git]
# Parse commits according to the conventional commits specification.
# See https://www.conventionalcommits.org
conventional_commits = true
# Exclude commits that do not match the conventional commits specification.
filter_unconventional = true
# Split commits on newlines, treating each line as an individual commit.
split_commits = false
# An array of regex based parsers to modify commit messages prior to further processing.
commit_preprocessors = [{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" }]
# Exclude commits that are not matched by any commit parser.
filter_commits = true
# Order releases topologically instead of chronologically.
topo_order = false
# Order of commits in each group/release within the changelog.
# Allowed values: newest, oldest
sort_commits = "newest"

commit_parsers = [
    { message = "^feat", group = "🚀 Features" },
    { message = "^fix", group = "🐛 Bug Fixes" },
    { message = "^doc", group = "📚 Documentation" },
    { message = "^perf", group = "⚡ Performance" },
    { message = "^refactor", group = "♻️ Refactoring" },
    { message = "^test", group = "✅ Testing" },
    { message = "^style", group = "🎨 Style" },
    { message = "^chore\\(deps\\)", group = "📦 Dependencies" },
    { message = "^chore|^ci", group = "⚙️ Miscellaneous Tasks" },
    { body = ".*security", group = "🔒 Security" },
]

[changelog]
# A Tera template to be rendered for each release in the changelog.
# See https://keats.github.io/tera/docs/#introduction
body = """
## What's Changed
{%- if version %} in {{ version | trim_start_matches(pat="v") }}{%- endif -%}
{% for group, commits in commits | group_by(attribute="group") %}
  ### {{ group | upper_first }}
  {% for commit in commits %}
    {% if commit.remote.pr_title -%}
      {%- set commit_message = commit.remote.pr_title -%}
    {%- else -%}
      {%- set commit_message = commit.message -%}
    {%- endif -%}
    * {{ commit_message | split(pat="\n") | first | trim }}\
      {% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif -%}
      {% if commit.remote.pr_number %} in \
        [#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) \
      {%- endif %}
  {%- endfor %}
{%- endfor -%}
{%- if github -%}
{% if github.contributors | length != 0 %}
  {% raw %}\n{% endraw -%}
  ### Contributors
{%- endif %}\
{% for contributor in github.contributors %}
  * @{{ contributor.username }}
{%- endfor -%}
{%- endif -%}
{% 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 -%}
"""
# Remove leading and trailing whitespaces from the changelog's body.
trim = true
# An array of regex based postprocessors to modify the changelog.
# Replace the placeholder `<REPO>` with a URL.
postprocessors = []

[remote.github]
owner = "karpetrosyan"
repo = "hishel"