Skip to content

Commit

Permalink
docs: add macro to changelog template
Browse files Browse the repository at this point in the history
  • Loading branch information
afuetterer committed Sep 28, 2023
1 parent 2c5bf40 commit 9b8f0aa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions templates/CHANGELOG.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. This projec

Available releases: <https://github.com/afuetterer/services-test4/releases>

{% macro version_compare_url(prev_version, version) -%}
https://github.com/afuetterer/services-test4/compare/{{ prev_version }}...{{ version }}
{%- endmacro %}
{% if context.history.unreleased | length > 0 %}
{# UNRELEASED #}
## Unreleased
Expand All @@ -16,10 +19,10 @@ Available releases: <https://github.com/afuetterer/services-test4/releases>
{% endif %}{% endfor %}{% endfor %}
{% endif %}
{# RELEASED #}
{% set base_url = 'https://github.com/afuetterer/services-test4/compare/' %}
{% for version, release in context.history.released.items() %}
{% if loop.nextitem %}
{% set compare_url = base_url ~ loop.nextitem[0] + '...' ~ version %}
{% set prev_version = loop.nextitem[0] %}
{% set compare_url = version_compare_url(prev_version, version) %}
## [{{ version.as_tag() }}]({{ compare_url }}) ({{ release.tagged_date.strftime("%Y-%m-%d") }})
{% else %}
## {{ version.as_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }})
Expand Down

0 comments on commit 9b8f0aa

Please sign in to comment.