From e2a312d05e41ec1ffbe4f490e23af2d1e6b1d095 Mon Sep 17 00:00:00 2001 From: Mathias Date: Sun, 23 Aug 2026 14:39:31 +0200 Subject: [PATCH] fix(ci): anchor the release-skip marker to a trailer, and test it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tagger searched the entire commit message for a bracketed marker as a substring. The commit that introduced the manifest-bump step described that marker in its own body — so the tagger read its own documentation as an instruction and skipped the release. Run 15 reported success with no tag, no manifest bump and no error. Same failure family as everything else in this sweep: the wrong thing happened silently. The rule is now a git trailer matched anchored to its own line, consistent with Bump-Type, and it lives in bin/should-skip-release rather than untested inside YAML. tests/release_skip_test.sh pins six cases, including the exact regression: a message that spells the marker out in prose must still tag. A marker you cannot mention without triggering is a footgun, not a mechanism. Bump-Type: patch Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01BeAp5LTscnz2W7Ubt4eJ6m --- .gitea/workflows/release.yml | 10 +++--- bin/should-skip-release | 25 +++++++++++++++ tests/release_skip_test.sh | 61 ++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 4 deletions(-) create mode 100755 bin/should-skip-release create mode 100644 tests/release_skip_test.sh diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index b1fc653..9ffcdbc 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -30,8 +30,10 @@ jobs: run: | set -euo pipefail last_commit=$(git log -1 --pretty=%B) - if printf '%s' "$last_commit" | grep -qi '\[skip-release\]'; then - echo "skipping — commit marked [skip-release]" + # Delegated to bin/should-skip-release so the rule is covered by + # tests/release_skip_test.sh rather than living untested in YAML. + if printf '%s\n' "$last_commit" | sh bin/should-skip-release; then + echo "skipping — commit carries the Skip-Release trailer" echo "skip=true" >> "$GITHUB_OUTPUT" exit 0 fi @@ -73,8 +75,8 @@ jobs: if [ "$current" != "$version" ]; then sed -i "s/\"version\"[[:space:]]*:[[:space:]]*\"$current\"/\"version\": \"$version\"/" "$manifest" git add "$manifest" - # [skip-release] stops this push from re-triggering the tagger. - git commit -m "chore(release): plugin.json version $version [skip-release]" + # The trailer below stops this push from re-triggering the tagger. + git commit -m "chore(release): plugin.json version $version" -m "Skip-Release: true" git push origin HEAD:main echo "bumped $manifest to $version" fi diff --git a/bin/should-skip-release b/bin/should-skip-release new file mode 100755 index 0000000..4a27d76 --- /dev/null +++ b/bin/should-skip-release @@ -0,0 +1,25 @@ +#!/bin/sh +# should-skip-release — reads a commit message on stdin. Exits 0 when the +# release tagger should skip this commit, 1 when it should tag. +# +# Skipping is opt-in via a git trailer: +# +# Skip-Release: true +# +# It is a TRAILER, matched anchored to its own line, deliberately. The first +# version searched the whole message for a bracketed marker as a substring, +# and the very commit that introduced the manifest-bump step described that +# marker in its body — so the tagger read its own documentation as an +# instruction and skipped the release. Success, no tag, no bump, no error +# (run 15, 2026-08-23). A marker you cannot mention without triggering is a +# footgun, not a mechanism. + +set -u + +msg=$(cat) + +if printf '%s\n' "$msg" | grep -qiE '^[[:space:]]*Skip-Release:[[:space:]]*true[[:space:]]*$'; then + exit 0 +fi + +exit 1 diff --git a/tests/release_skip_test.sh b/tests/release_skip_test.sh new file mode 100644 index 0000000..8a3f608 --- /dev/null +++ b/tests/release_skip_test.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# Tests for bin/should-skip-release. +# +# The regression these exist for: an unanchored substring match let a commit +# that merely *described* the skip marker skip its own release. + +set -u + +ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +SUT="$ROOT/bin/should-skip-release" + +pass=0 +fail=0 + +if [ ! -f "$SUT" ]; then + printf 'FAIL: %s does not exist\n' "$SUT" + exit 1 +fi + +# expect