fix(ci): anchor the release-skip marker to a trailer, and test it
release / tag (push) Successful in 1s

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BeAp5LTscnz2W7Ubt4eJ6m
This commit is contained in:
2026-08-23 14:39:31 +02:00
co-authored by Claude Opus 5
parent 78b9b59eca
commit e2a312d05e
3 changed files with 92 additions and 4 deletions
+6 -4
View File
@@ -30,8 +30,10 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
last_commit=$(git log -1 --pretty=%B) last_commit=$(git log -1 --pretty=%B)
if printf '%s' "$last_commit" | grep -qi '\[skip-release\]'; then # Delegated to bin/should-skip-release so the rule is covered by
echo "skipping — commit marked [skip-release]" # 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" echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0 exit 0
fi fi
@@ -73,8 +75,8 @@ jobs:
if [ "$current" != "$version" ]; then if [ "$current" != "$version" ]; then
sed -i "s/\"version\"[[:space:]]*:[[:space:]]*\"$current\"/\"version\": \"$version\"/" "$manifest" sed -i "s/\"version\"[[:space:]]*:[[:space:]]*\"$current\"/\"version\": \"$version\"/" "$manifest"
git add "$manifest" git add "$manifest"
# [skip-release] stops this push from re-triggering the tagger. # The trailer below stops this push from re-triggering the tagger.
git commit -m "chore(release): plugin.json version $version [skip-release]" git commit -m "chore(release): plugin.json version $version" -m "Skip-Release: true"
git push origin HEAD:main git push origin HEAD:main
echo "bumped $manifest to $version" echo "bumped $manifest to $version"
fi fi
+25
View File
@@ -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
+61
View File
@@ -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 <skip|tag> <label> <<message on stdin>>
expect() {
_want=$1
_label=$2
_msg=$3
printf '%s\n' "$_msg" | sh "$SUT"
_rc=$?
if [ "$_want" = skip ]; then _wrc=0; else _wrc=1; fi
if [ "$_rc" -eq "$_wrc" ]; then
pass=$((pass + 1)); printf ' ok %s\n' "$_label"
else
fail=$((fail + 1)); printf ' FAIL %s (want %s, rc=%s)\n' "$_label" "$_want" "$_rc"
fi
}
expect skip 'trailer on its own line' 'chore(release): bump
Skip-Release: true'
expect skip 'trailer, case-insensitive' 'chore: x
skip-release: TRUE'
expect tag 'ordinary commit' 'feat: add a thing
Bump-Type: minor'
# --- the actual regression -------------------------------------------------
expect tag 'prose MENTIONING the marker must still tag' 'docs+ci: document the release flow
CI commits the manifest bump with a Skip-Release: true trailer so it does
not re-trigger the tagger. The old [skip-release] marker was a substring
match, which is exactly why this commit would have skipped itself.
Bump-Type: patch'
expect tag 'legacy bracketed marker no longer skips' 'chore: something [skip-release]'
expect tag 'empty message' ''
printf '\nrelease_skip: %d passed, %d failed\n' "$pass" "$fail"
[ "$fail" -eq 0 ]