From f2b7614bd236d1c5b49210e89278fc4036100c9d Mon Sep 17 00:00:00 2001 From: Jan Buchar Date: Thu, 4 Jun 2026 16:27:23 +0200 Subject: [PATCH 1/2] fix(git-cliff-release): Improve behavior with no existing version tag --- git-cliff-release/cliff.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git-cliff-release/cliff.toml b/git-cliff-release/cliff.toml index 67368d1..0c1df64 100644 --- a/git-cliff-release/cliff.toml +++ b/git-cliff-release/cliff.toml @@ -102,8 +102,11 @@ commit_parsers = [ protect_breaking_commits = true # filter out the commits that are not matched by commit parsers filter_commits = false -# regex for matching git tags -tag_pattern = "v[0-9]+\\." +# regex for matching git tags. +# The "v" prefix is optional so that the default first version (e.g. "0.1.0"), +# which git-cliff generates without a prefix when there are no existing tags, +# still validates against the pattern. +tag_pattern = "v?[0-9]+\\." # sort the tags topologically topo_order = false # sort the commits inside sections by oldest/newest order From be99332f66bbd5b261c2a4403e7e7cfa2ae42327 Mon Sep 17 00:00:00 2001 From: Jan Buchar Date: Fri, 5 Jun 2026 10:53:57 +0200 Subject: [PATCH 2/2] Simplify + one more fix --- git-cliff-release/action.yaml | 6 ++++-- git-cliff-release/cliff.toml | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/git-cliff-release/action.yaml b/git-cliff-release/action.yaml index 9e1634d..1d5428a 100644 --- a/git-cliff-release/action.yaml +++ b/git-cliff-release/action.yaml @@ -88,8 +88,10 @@ runs: elif [[ '${{ inputs.release_type }}' = auto ]]; then version_number=$(git-cliff --bumped-version | sed s/^v//) - # If there are no commits that increase semver, break - if [[ "$(git describe --tags --abbrev=0)" = "v${version_number}" ]]; then + # If there are no commits that increase semver, break. + # In a repo with no tags yet there is always something to release, and + # git describe would fail with a non-zero exit - guard against that. + if latest_tag=$(git describe --tags --abbrev=0 2> /dev/null) && [[ "$latest_tag" = "v${version_number}" ]]; then echo "::error title=Nothing to release::There were no commits that trigger a version bump since the last release" exit 1 fi diff --git a/git-cliff-release/cliff.toml b/git-cliff-release/cliff.toml index 0c1df64..2f34c6a 100644 --- a/git-cliff-release/cliff.toml +++ b/git-cliff-release/cliff.toml @@ -61,6 +61,9 @@ trim = true postprocessors = [] [bump] +# Version used for repositories with no existing tags. The "v" prefix keeps it +# matching tag_pattern, so setting up a brand-new repo works out of the box. +initial_tag = "v0.1.0" # With 0.x.y version, breaking commits should only increase the minor version and feature commits should only increase the patch version breaking_always_bump_major = false features_always_bump_minor = false @@ -102,11 +105,8 @@ commit_parsers = [ protect_breaking_commits = true # filter out the commits that are not matched by commit parsers filter_commits = false -# regex for matching git tags. -# The "v" prefix is optional so that the default first version (e.g. "0.1.0"), -# which git-cliff generates without a prefix when there are no existing tags, -# still validates against the pattern. -tag_pattern = "v?[0-9]+\\." +# regex for matching git tags +tag_pattern = "v[0-9]+\\." # sort the tags topologically topo_order = false # sort the commits inside sections by oldest/newest order