Skip to content

Commit 8beab2d

Browse files
committed
fix(gate): changelog_reachability accepts the pending release heading
`check_changelog_reachability.sh --gate` required the first heading after [Unreleased] to be the newest tag's. A hand-written MINOR bump stamps its own `## [X.Y.0] - date` heading before the tag exists (release.yml's verbatim path does not stamp), so the bump commit failed the gate step `changelog_reachability`, locally and, once CI fetches tags, in CI too. The check now lets one heading sit above the newest tag's when build.zig.zon names that version, the version is newer than the newest tag, and no tag for it exists. Then the newest tag's heading must be the second. Any other heading there is still a violation. Checked in a scratch clone with the release tags: bump commit passes; heading 1.16.0 against zon 1.15.0 fails; a stray [1.15.0] heading with zon at 1.14.12 fails; the pre-bump tree passes. Smell-audited: 1: one bounded exception keyed on build.zig.zon, the version SSOT
1 parent a00ce11 commit 8beab2d

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

‎scripts/check_changelog_reachability.sh‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
# v1.14.11 appended their entries under `## [1.14.8]` and nothing noticed
88
# (fixed by bba2e79f). Every `vX.Y.Z` tag reachable from HEAD, from v1.0.0
99
# on, must have a `## [X.Y.Z] - YYYY-MM-DD` heading, and the newest tag's
10-
# heading must be the first one after `## [Unreleased]`.
10+
# heading must be the first one after `## [Unreleased]`, or the second when
11+
# the first is the untagged release build.zig.zon names.
1112
#
1213
# 2. `[Unreleased]` describes something that has already shipped. An entry
1314
# that is also present in the newest tag's own `[Unreleased]` section went
@@ -80,6 +81,25 @@ else
8081
fi
8182

8283
newest_v="${newest_tag#v}"
84+
85+
# A hand-stamped MINOR/MAJOR heading precedes its tag: allowed only while
86+
# build.zig.zon names that version, it is newer, and no such tag exists.
87+
pending_v="$(sed -nE 's/^[[:space:]]*\.version = "([0-9]+\.[0-9]+\.[0-9]+)",[[:space:]]*$/\1/p' build.zig.zon 2>/dev/null | sed -n 1p)"
88+
if [ -n "$pending_v" ] \
89+
&& ! git rev-parse -q --verify "refs/tags/v$pending_v" >/dev/null \
90+
&& [ "$(printf '%s\n%s\n' "$newest_v" "$pending_v" | sort -V | sed -n 2p)" = "$pending_v" ] \
91+
&& [ "$pending_v" != "$newest_v" ]; then
92+
case "$first_after_unreleased" in
93+
"## [$pending_v] - "*)
94+
first_after_unreleased="$(awk '
95+
/^## \[Unreleased\]/ { seen = 1; next }
96+
seen && /^## / { n++; if (n == 2) { print; exit } }
97+
' "$CHANGELOG")"
98+
echo "check_changelog_reachability: ok, [$pending_v] is the pending release build.zig.zon names (no v$pending_v tag yet)"
99+
;;
100+
esac
101+
fi
102+
83103
case "$first_after_unreleased" in
84104
"## [$newest_v] - "*) ;;
85105
*)

0 commit comments

Comments
 (0)