# git-cliff (https://git-cliff.org) builds CHANGELOG.md and the release # notes from the commits on main. Pull requests are squash-merged, so each # one is a single commit whose message is the PR title: a conventional one # (feat: …, fix: …, perf: …) puts it in the changelog, anything else # (chore, ci, docs, refactor, test, …) leaves it out. # # git cliff --unreleased # what the next release would say [changelog] header = """ # Changelog Every release of lazysecrets, newest first.\n """ body = """ {% if version -%} ## {{ version }} – {{ timestamp | date(format="%Y-%m-%d") }} {% else -%} ## Unreleased {% endif -%} {% if commits | length == 0 %} Hello world 👋 {% endif -%} {% for group, commits in commits | group_by(attribute="group") %} ### {{ group | striptags | trim }} {% for commit in commits %} - {% if commit.breaking %}**Breaking:** {% endif %}{{ commit.message | split(pat="\n") | first | upper_first | trim }}\ {% endfor %} {% endfor %}\n """ footer = "" trim = true # Runs on each part (header, every release) separately. postprocessors = [ { pattern = "\n{3,}", replace = "\n\n" }, ] [git] conventional_commits = true filter_unconventional = false split_commits = false protect_breaking_commits = true tag_pattern = "v[0-9]+\\.[0-9]+\\.[0-9]+$" sort_commits = "oldest" commit_preprocessors = [ # A merge commit (not a squash) says "Merge pull request 'feat: …' (#4) # from branch into main": keep the title and number. { pattern = "^Merge pull request '(.+)' \\((#[0-9]+)\\) from .*", replace = "${1} (${2})" }, # Titles may be written "[feat] x", "[feat]: x" or "feat:x" (see # pr-title.yml); all become "feat: x". { pattern = "^\\[(feat|fix|perf|refactor|docs|test|ci|chore|build|style|revert)(\\([^)]*\\))?(!?)\\](!?):?\\s*", replace = "${1}${2}${3}${4}: " }, { pattern = "^(feat|fix|perf|refactor|docs|test|ci|chore|build|style|revert)(\\([^)]*\\))?(!?):(\\S)", replace = "${1}${2}${3}: ${4}" }, ] commit_parsers = [ { body = "\\[skip changelog\\]", skip = true }, { message = "^[a-z]+(\\(.*\\))?!:", group = "Added" }, { message = "^feat", group = "Added" }, { message = "^perf", group = "Changed" }, { message = "^fix", group = "Fixed" }, { message = ".*", skip = true }, ]