From 2b1546a181adbe182be4ede9f49a66fe065d5e2b Mon Sep 17 00:00:00 2001 From: Awiteb Date: Tue, 28 May 2024 22:24:54 +0300 Subject: [PATCH] chore: Initialize the changelogs Signed-off-by: Awiteb --- CHANGELOG.md | 11 +++++ cliff.toml | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 cliff.toml diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f353e5a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## unreleased + +## 0.1.0 - 2023-11-18 + +This changelog was generated by [git-cliff](https://github.com/orhun/git-cliff) diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..d8b81e7 --- /dev/null +++ b/cliff.toml @@ -0,0 +1,112 @@ +[changelog] +# changelog header +header = """ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n +""" +body = """ +{# Check if there is a `BREAKING-CHANGE` footer in the message or not #}\ +{% macro is_breaking(commit) %}\ + {{"BREAKING-CHANGE" in commit.message}}\ +{% endmacro is_breaking %}\ + +{# Return the commit header #}\ +{% macro commit_header(commit) %}\ + {{commit.message | split(pat="\n") | nth(n=0) | upper_first }}\ +{% endmacro commit_header %}\ + +{# Return the `BREAKING-CHANGE` footer message #}\ +{% macro bc_des(commit) %}\ + {% set lines = [] %}\ + {% set found_breaking = false %}\ + {% for line in commit.message | split(pat="\n") %}\ + {% if found_breaking and line is not containing(":") %}\ + {% set_global lines = lines | concat(with=line) %}\ + {% elif found_breaking and line is containing(":") %}\ + {% set_global found_breaking = false %}\ + {% endif %}\ + {% if line is starting_with("BREAKING-CHANGE") %}\ + {% set_global found_breaking = true %}\ + {% set breaking_line = line | split(pat=":") | nth(n=1) %}\ + {% set_global lines = lines | concat(with=breaking_line) %}\ + {% endif %}\ + {% endfor %}\ + {% if lines | length != 0 %}\ + {{ lines | join(sep="\n") | trim_end(pat="\n") }}\ + {% endif %}\ +{% endmacro bc_des %}\ + +{% if version %}\ + {% if previous.version %}\ + ## [{{ version | trim_start_matches(pat="v") }}](/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }} + {% else %}\ + ## {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }} + {% endif %}\ +{% else %}\ + ## unreleased +{% endif %}\ + +{% for group, commits in commits | group_by(attribute="group") %}\ + ### {{ group | upper_first }} + {% for commit in commits | sort(attribute="message") %}\ + - {{ self::commit_header(commit=commit) }} ([`{{ commit.id | truncate(length=7, end="") }}`](/commit/{{ commit.id }})) + {% if self::is_breaking(commit=commit) == "true" %}\ + \t- **BC**: {{self::bc_des(commit=commit)}} + {% endif %}\ + {% endfor %}\ +{% endfor %}\n +""" +# remove the leading and trailing whitespace from the template +trim = true +# changelog footer +footer = """ +This changelog was generated by [git-cliff](https://github.com/orhun/git-cliff) +""" +# postprocessors +postprocessors = [ + {pattern = '', replace = "https://git.4rs.nl/awiteb/telepingbot"}, # replace repository URL + {pattern = '- (\w+)(\(\w+\))?:', replace = "- "}, # Remove the type + {pattern = '- \((\w+)\):', replace = "- (**$1**)"}, # Make the scope blod + {pattern = "\t", replace = " "}, # Replace tap with 4 spaces +] + +[git] +# parse the commits based on https://www.conventionalcommits.org +conventional_commits = false +# filter out the commits that are not conventional +filter_unconventional = true +# process each line of a commit as an individual commit +split_commits = false +# regex for preprocessing the commit messages +commit_preprocessors = [ + {pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([**#${2}**](/issues/${2}))"}, # replace issue numbers (Note the PR is also an issue in Forgejo, so this will also link to PRs) + {pattern = ' +$', replace = ""}, # Remove trailing whitespace. + {pattern = ' +', replace = " "}, # Replace multiple spaces with a single space. +] +# regex for parsing and grouping commits +commit_parsers = [ + {message = "^feat", group = "Added"}, + {message = "^fix", group = "Fixed"}, + {message = "^(refactor|change)", group = "Changed"}, + {message = "^deprecate", group = "Deprecated"}, + {message = "^remove", group = "Removed"}, + {message = "^security", group = "Security"}, +] +# protect breaking changes from being skipped due to matching a skipping commit_parser +protect_breaking_commits = false +# filter out the commits that are not matched by commit parsers +filter_commits = false +# regex for matching git tags +tag_pattern = "v[0-9]+\\.[0-9]+\\.[0-9]+" + +# regex for skipping tags +skip_tags = "" +# regex for ignoring tags +ignore_tags = "v[0-9]+\\.[0-9]+\\.[0-9]+-(alpha|beta|rc)(\\.[0-9]+)?" +# sort the tags topologically +topo_order = false +# sort the commits inside sections by oldest/newest order +sort_commits = "oldest"