Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
build: populate changelog with info from Github
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgacsal committed Feb 20, 2024
1 parent ee95c28 commit 041e463
Showing 1 changed file with 44 additions and 4 deletions.
48 changes: 44 additions & 4 deletions cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,53 @@ header = ""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{%- macro remote_url() -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
{% 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 %}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}{% if commit.breaking %}[**BREAKING**] {% endif %}{{ commit.message | upper_first }}\
{% endfor %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
{% if commit.github.pr_title -%}
{%- set commit_message = commit.github.pr_title -%}
{%- else -%}
{%- set commit_message = commit.message -%}
{%- endif -%}
* {{ commit_message | split(pat="\n") | first | trim }}\
{% if commit.github.username %} by @{{ commit.github.username }}{%- endif -%}
{% if commit.github.pr_number %} in \
[#{{ commit.github.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.github.pr_number }}) \
{%- endif %}
{% endfor -%}
{% endfor %}\n
{% 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 }} made their first contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
{%- endif %}
{%- endfor -%}
{% if version %}
{% if previous.version %}
**Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}
{% endif %}
{% else -%}
**Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...HEAD
{% endif %}
"""
# remove the leading and trailing whitespace from the template
trim = true
Expand Down Expand Up @@ -79,3 +115,7 @@ topo_order = false
sort_commits = "newest"
# limit the number of commits included in the changelog.
# limit_commits = 42

[remote.github]
owner = "openclarity"
repo = "vmclarity"

0 comments on commit 041e463

Please sign in to comment.