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

[remote.github]
owner = "roflmuffin"
repo = "CounterStrikeSharp"
# token = ""

[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 }}{%- endif -%}
{% for commit in commits %}
  * {{ commit.message | split(pat="\n") | first | trim }}\
    {% if commit.remote.username and commit.remote.username != remote.github.owner %} by \
      [@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }}) \
    {%- endif -%}
    {% if commit.remote.pr_number %} in \
      [#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }})\
    {%- endif %}
    {%- if commit.id %} ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url()}}/commit/{{ commit.id }})){%- endif -%}
    
{%- endfor -%}

{%- if github -%}
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
  {% raw %}\n{% endraw -%}
  ## New Contributors
{%- endif %}\
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
  * [@{{ contributor.username }}](https://github.com/{{ contributor.username }}) made their first contribution
    {%- if contributor.pr_number %} in \
      [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
    {%- endif %}
{%- endfor -%}
{%- endif -%}

{% if version %}
    
{% 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
# A Tera template to be rendered as the changelog's footer.
# See https://keats.github.io/tera/docs/#introduction
footer = """
<!-- generated by git-cliff -->
"""
# An array of regex based postprocessors to modify the changelog.
# Replace the placeholder `<REPO>` with a URL.
postprocessors = []

[git]
# Parse commits according to the conventional commits specification.
# See https://www.conventionalcommits.org
conventional_commits = false
# 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 = "" },
    { pattern = '\[no ci\]', replace = "" }
  ]
commit_parsers = [
    { message = "^release:", skip = true }
]
# Exclude commits that are not matched by any commit parser.
filter_commits = false
# 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"
tag_pattern = "v[0-9]+\\.[0-9]+\\.[0-9]+"
