|
| 1 | +{# Using a literal newline to set the newline variable -#} |
| 2 | +{% set newline = " |
| 3 | +" -%} |
| 4 | + |
| 5 | +{% set commit_base_url = repository_url ~ "/commit/" -%} |
| 6 | +{% set compare_base_url = repository_url ~ "/compare/" -%} |
| 7 | +{% set pr_base_url = repository_url ~ "/pull/" -%} |
| 8 | + |
| 9 | +{% if version.tag -%} |
| 10 | + ## {{ version.tag | trim_start_matches(pat="v") }} ({{ date | date(format="%Y-%m-%d") }}) |
| 11 | +{% else -%} |
| 12 | + {% set from = from.id -%} |
| 13 | + {% set to = version.id -%} |
| 14 | + |
| 15 | + {% set from_shorthand = from.id | truncate(length=7, end="") -%} |
| 16 | + {% set to_shorthand = version.id | truncate(length=7, end="") -%} |
| 17 | + |
| 18 | + ## Unreleased ([`{{ from_shorthand ~ ".." ~ to_shorthand }}`]({{ compare_base_url ~ from_shorthand ~ ".." ~ to_shorthand }})) |
| 19 | +{% endif -%} |
| 20 | + |
| 21 | +{% for type, typed_commits in commits | sort(attribute="type") | group_by(attribute="type") %} |
| 22 | +{# The `striptags` removes the HTML comments added while grouping -#} |
| 23 | +### {{ type | striptags | trim | upper_first }} |
| 24 | +{% for scope, scoped_commits in typed_commits | group_by(attribute="scope") %} |
| 25 | +- {{ "**" ~ scope ~ ":" ~ "**" -}} |
| 26 | + {% for commit in scoped_commits | sort(attribute="date") -%} |
| 27 | + {% set shorthand = commit.id | truncate(length=7, end="") -%} |
| 28 | + {% set commit_link = commit_base_url ~ commit.id -%} |
| 29 | + {# Replace PR numbers in commit message with PR link -#} |
| 30 | + {% set pr_number = commit.summary | split(pat="(#") | last | trim_end_matches(pat=")") -%} |
| 31 | + {% set pr_link = "[#" ~ pr_number ~ "](" ~ pr_base_url ~ pr_number ~ ")" -%} |
| 32 | + {% if scoped_commits | length != 1 %}{{ newline ~ " - " }}{% else %}{{ " " }}{% endif -%} |
| 33 | + {{ commit.summary | upper_first | trim | replace(from="#" ~ pr_number, to=pr_link) }} ([`{{ shorthand }}`]({{ commit_link }})) |
| 34 | + {%- endfor -%} |
| 35 | +{% endfor -%} |
| 36 | + |
| 37 | +{% for commit in typed_commits | unscoped | sort(attribute="date") -%} |
| 38 | + {% set shorthand = commit.id | truncate(length=7, end="") -%} |
| 39 | + {% set commit_link = commit_base_url ~ commit.id -%} |
| 40 | + {# Replace PR numbers in commit message with PR link -#} |
| 41 | + {% set pr_number = commit.summary | split(pat="(#") | last | trim_end_matches(pat=")") -%} |
| 42 | + {% set pr_link = "[#" ~ pr_number ~ "](" ~ pr_base_url ~ pr_number ~ ")" -%} |
| 43 | + {{ newline ~ "- "}}{{ commit.summary | upper_first | trim | replace(from="#" ~ pr_number, to=pr_link) }} ([`{{ shorthand }}`]({{ commit_link }})) |
| 44 | +{%- endfor %} |
| 45 | +{% endfor %} |
| 46 | +{% if version.tag and from.tag -%} |
| 47 | + **Full Changelog:** [`{{ from.tag ~ "..." ~ version.tag }}`]({{ compare_base_url ~ from.tag ~ "..." ~ version.tag }}) |
| 48 | +{%- elif version.tag and from.id -%} |
| 49 | + **Full Changelog:** [`{{ from.id ~ "..." ~ version.tag }}`]({{ compare_base_url ~ from.id ~ "..." ~ version.tag }}) |
| 50 | +{%- else -%} |
| 51 | + {% set from = from.id -%} |
| 52 | + {% set to = version.id -%} |
| 53 | + {% set from_shorthand = from.id | truncate(length=7, end="") -%} |
| 54 | + {% set to_shorthand = version.id | truncate(length=7, end="") -%} |
| 55 | + **Full Changelog:** [`{{ from_shorthand ~ "..." ~ to_shorthand }}`]({{ compare_base_url ~ from_shorthand ~ "..." ~ to_shorthand }}) |
| 56 | +{%- endif %} |
0 commit comments