chore(changelog): show full commit message (#423)

This allows someone reading the changelog to search for information
about breaking changes or implementation of new functionality.

- refactored the commit template part to a macro instead of repeating it
- added a link to the commit and to the release
- updated the current changelog for the alpha and unreleased changes
- Automatically changed the existing * lists to - lists
This commit is contained in:
Josh McKinney 2023-08-24 00:59:59 -07:00 committed by GitHub
parent 80fd77e476
commit a937500ae4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 677 additions and 164 deletions

View file

@ -7,3 +7,6 @@ no-inline-html:
- summary - summary
line-length: line-length:
line_length: 100 line_length: 100
# to support repeated headers in the changelog
no-duplicate-heading: false

File diff suppressed because it is too large Load diff

View file

@ -3,35 +3,51 @@
[changelog] [changelog]
# changelog header # changelog header
header = """ header = """
# Changelog\n # Changelog
All notable changes to this project will be documented in this file.\n
All notable changes to this project will be documented in this file.
""" """
# template for the changelog body # template for the changelog body
# https://tera.netlify.app/docs/#introduction # https://keats.github.io/tera/docs/#introduction
# note that the - before / after the % controls whether whitespace is rendered between each line.
# Getting this right so that the markdown renders with the correct number of lines between headings
# code fences and list items is pretty finicky. Note also that the 4 backticks in the commit macro
# is intentional as this escapes any backticks in the commit body.
body = """ body = """
{% if version %}\ {%- if not version %}
## {{ version }} - {{ timestamp | date(format="%Y-%m-%d") }} ## [unreleased]
{% else %}\ {% else -%}
## [unreleased] ## [{{ version }}](https://github.com/ratatui-org/ratatui/releases/tag/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
{% endif %}\ {% endif -%}
{% macro commit(commit) -%}
- *({{commit.scope | default(value = "uncategorized")}})* {{ commit.message | upper_first }}
([{{ commit.id | truncate(length=7, end="") }}]({{ "https://github.com/ratatui-org/ratatui/commit/" ~ commit.id }}))
{%- if commit.breaking %} [**breaking**]{% endif %}
{%- if commit.body %}
````text {#- 4 backticks escape any backticks in body #}
{{commit.body | indent(prefix=" ") }}
````
{%- endif %}
{% endmacro -%}
{% for group, commits in commits | group_by(attribute="group") %} {% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }} ### {{ group | striptags | trim | upper_first }}
{% for commit in commits {% for commit in commits | filter(attribute="scope") | sort(attribute="scope") %}
| filter(attribute="scope") {{ self::commit(commit=commit) }}
| sort(attribute="scope") %} {%- endfor -%}
- *({{commit.scope}})* {{ commit.message | upper_first }}{% if commit.breaking %} [**breaking**]{% endif %} {% for commit in commits %}
{%- endfor -%} {%- if not commit.scope %}
{% raw %}\n{% endraw %}\ {{ self::commit(commit=commit) }}
{%- for commit in commits %} {%- endif -%}
{%- if commit.scope -%} {%- endfor -%}
{% else -%} {%- endfor %}
- *(uncategorized)* {{ commit.message | upper_first }}{% if commit.breaking %} [**breaking**]{% endif %}
{% endif -%}
{% endfor -%}
{% endfor %}\n
""" """
# remove the leading and trailing whitespace from the template # remove the leading and trailing whitespace from the template
trim = true trim = false
# changelog footer # changelog footer
footer = """ footer = """
<!-- generated by git-cliff --> <!-- generated by git-cliff -->
@ -69,6 +85,9 @@ commit_parsers = [
{ message = "^build", group = "<!-- 09 -->Build" }, { message = "^build", group = "<!-- 09 -->Build" },
{ message = "^ci", group = "<!-- 10 -->Continuous Integration" }, { message = "^ci", group = "<!-- 10 -->Continuous Integration" },
{ message = "^revert", group = "<!-- 11 -->Reverted Commits" }, { message = "^revert", group = "<!-- 11 -->Reverted Commits" },
# handle some old commits styles from pre 0.4
{ message = "^(Buffer|buffer|Frame|frame|Gauge|gauge|Paragraph|paragraph):", group = "<!-- 07 -->Miscellaneous Tasks" },
{ message = "^\\[", group = "<!-- 07 -->Miscellaneous Tasks" },
] ]
# protect breaking changes from being skipped due to matching a skipping commit_parser # protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false protect_breaking_commits = false