From 37004c0a4af4286f462078c4c18310bc97b4838f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nerijus=20Bend=C5=BEi=C5=ABnas?= Date: Fri, 1 May 2026 09:09:07 +0300 Subject: [PATCH] chore(release): customise git-cliff release notes output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Default output includes ci/docs noise and bare SHAs with no links. Filtering those types keeps release notes focused on user-visible changes, short SHAs linked to GitHub commits aid traceability, and the new contributors section surfaces first-time contributors automatically. Add cliff.toml: skip docs/ci types, link 7-char SHAs to GitHub commits, add first-time contributors section via GitHub API integration. Pass GITHUB_TOKEN to git-cliff-action step and add pull-requests: read permission so the contributor lookup succeeds in CI. Signed-off-by: Nerijus Bendžiūnas --- .github/workflows/release.yml | 3 ++ cliff.toml | 56 +++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 cliff.toml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b4723f1..967bcf8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ on: # yamllint disable-line rule:truthy permissions: contents: write id-token: write + pull-requests: read jobs: release: runs-on: ubuntu-latest @@ -34,6 +35,8 @@ jobs: id: git-cliff # yamllint disable-line rule:line-length uses: orhun/git-cliff-action@f50e11560dce63f7c33227798f90b924471a88b5 # ratchet:orhun/git-cliff-action@v4.8.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: args: --current - name: Create GitHub Release diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..66c4061 --- /dev/null +++ b/cliff.toml @@ -0,0 +1,56 @@ +[changelog] +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else %}\ + ## [unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | striptags | trim | upper_first }} + {% for commit in commits %} + - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ + {% if commit.breaking %}[**breaking**] {% endif %}\ + {{ commit.message | upper_first }} \ + ([`{{ commit.id | truncate(length=7, end="") }}`]\ + (https://github.com/benner/commit-guard/commit/{{ commit.id }}))\ + {% endfor %} +{% endfor %} +{%- if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %} + +### New Contributors +{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %} + - @{{ contributor.username }} made their first contribution\ + {% if contributor.pr_number %} in \ + [#{{ contributor.pr_number }}]\ + (https://github.com/benner/commit-guard/pull/{{ contributor.pr_number }})\ + {% endif %} +{% endfor %} +{%- endif %} +""" +trim = true + +[remote.github] +owner = "benner" +repo = "commit-guard" + +[git] +conventional_commits = true +filter_unconventional = true +split_commits = false +protect_breaking_commits = false +commit_parsers = [ + { message = "^feat", group = "🚀 Features" }, + { message = "^fix", group = "🐛 Bug Fixes" }, + { message = "^perf", group = "⚡ Performance" }, + { message = "^refactor", group = "🚜 Refactor" }, + { message = "^style", group = "🎨 Styling" }, + { message = "^test", group = "🧪 Testing" }, + { message = "^docs", skip = true }, + { message = "^ci", skip = true }, + { message = "^chore", group = "⚙️ Miscellaneous Tasks" }, + { message = "^revert", group = "◀️ Revert" }, + { body = ".*security", group = "🛡️ Security" }, +] +filter_commits = true +topo_order = false +sort_commits = "oldest"