From e3b66934029596f057c32c4be50f8cafcd241d3f Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 2 Mar 2026 19:52:12 +0000 Subject: [PATCH] fix: correct version-check hook to use global latest tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pre-commit version check hook was incorrectly using `git describe` to find the latest tag, which only traverses the current branch's ancestry. On feature branches that predate release tags applied to main/nightly, this caused false failures — reporting v0.19.1 as latest even though v0.20.0 and v0.21.0 existed globally. Replaced with `git tag --sort=-v:refname | grep semver | head -1` so the check always compares .version against the true latest release tag in the repository, independent of which branch is checked out. --- .version | 2 +- scripts/check-version-match-tag.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.version b/.version index 3a7f17e4..759e855f 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -v0.19.1 +v0.21.0 diff --git a/scripts/check-version-match-tag.sh b/scripts/check-version-match-tag.sh index 2189fdfc..e2447c63 100755 --- a/scripts/check-version-match-tag.sh +++ b/scripts/check-version-match-tag.sh @@ -19,7 +19,11 @@ if [ ! -f ".version" ]; then fi VERSION_FILE=$(cat .version | tr -d '\n' | tr -d '\r') -GIT_TAG="$(git describe --tags --abbrev=0 2>/dev/null || echo "")" +# Use the globally latest semver tag, not just tags reachable from HEAD. +# git describe --tags --abbrev=0 only finds tags in the current branch's +# ancestry, which breaks on feature branches where release tags were applied +# to main/nightly and haven't been merged back yet. +GIT_TAG="$(git tag --sort=-v:refname 2>/dev/null | grep -E '^v?[0-9]+\.[0-9]+' | head -1 || echo "")" if [ -z "$GIT_TAG" ]; then echo "No tags in repository; cannot validate .version against tag"