From 4df5e3b140b0c2c22815f8d5c3538c8fd92d6bee Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Fri, 24 Jul 2026 16:53:36 -0500 Subject: [PATCH] Fix release-tag.sh changelog check failing under pipefail The jj branch of release-tag.sh confirms the release PR landed by grepping origin/main's changelog for the version heading. grep -q exits on its first match, which hands git show a SIGPIPE and exit 141, and set -o pipefail turns that into a failed pipeline. So the check reported "changelog does not contain '## vX.Y.Z'" against a changelog that plainly contained it, and --force was the only way past it. Read the file into a variable and grep that instead. A git show failure (missing path, bad rev) still leaves the variable empty and fails the check, so a genuinely absent changelog is caught the way it was before. Caught while tagging v0.12.1, which was the first real release to go through the jj path. It landed in #950 a day after v0.12.0 was tagged, so nothing had exercised it until now. --- hack/release-tag.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hack/release-tag.sh b/hack/release-tag.sh index f141ad40..8e0ae575 100755 --- a/hack/release-tag.sh +++ b/hack/release-tag.sh @@ -91,7 +91,12 @@ if [ "$JJ_MODE" = true ]; then if [ "$FORCE" = true ]; then echo "Warning: Skipping changelog check (--force); fetch and origin/main targeting still run" else - if ! git show "$TARGET":docs/docs/changelog.md 2>/dev/null | grep -q "^## $VERSION"; then + # Read the changelog into a variable rather than piping it. `grep -q` exits + # on its first match, which SIGPIPEs `git show` into exit 141, and pipefail + # turns that into a failed check even when the version is present. + REMOTE_CHANGELOG=$(git show "$TARGET":docs/docs/changelog.md 2>/dev/null || true) + + if ! grep -q "^## $VERSION" <<<"$REMOTE_CHANGELOG"; then echo "Error: origin/main changelog does not contain '## $VERSION'" echo "Has the release PR been merged?" echo "Or use --force to skip this check"