Skip to content

Commit 092dcc0

Browse files
committed
fix(ci): cut-release tombstone sync handles no-op substitution
The 'Sync plugin versions' step has two Python heredocs that rewrite the version in tombstones/pypi/pyproject.toml and the heading in tombstones/vscode/CHANGELOG.md. Both used 'if new_t == t' as the sanity guard, which incorrectly fired whenever the substitution was a byte-identical no-op — exactly what happens when the file is authored directly at the target version (as the tombstones were for v0.3.0 in PR #186). Replace the post-substitution equality check with an explicit pre-substitution anchor-presence check: if not re.search(PATTERN, t, flags=re.MULTILINE): raise SystemExit('::error::... anchor not found.') new_t = re.sub(PATTERN, ..., t, count=1, flags=re.MULTILINE) p.write_text(new_t, ...) This correctly distinguishes 'regex anchor missed' (real bug; fail) from 'anchor matched, value already at target' (legitimate; no-op write is harmless because the workflow's downstream Update CHANGELOG step always mutates CHANGELOG.md so the resulting commit is non-empty). Failure surfaced by run 26608283472 (v0.3.0 first dispatch); the release branch was not pushed because the failure happened before Commit and push.
1 parent f099947 commit 092dcc0

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

.github/workflows/cut-release.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,10 @@ jobs:
125125
v = os.environ["VERSION"]
126126
p = pathlib.Path("tombstones/pypi/pyproject.toml")
127127
t = p.read_text(encoding="utf-8")
128-
new_t = re.sub(r'^version = "[^"]+"', f'version = "{v}"', t, count=1, flags=re.MULTILINE)
129-
if new_t == t:
130-
raise SystemExit("::error::tombstones/pypi/pyproject.toml version was not updated; check the regex anchor.")
128+
PATTERN = r'^version = "[^"]+"'
129+
if not re.search(PATTERN, t, flags=re.MULTILINE):
130+
raise SystemExit("::error::tombstones/pypi/pyproject.toml version regex anchor not found.")
131+
new_t = re.sub(PATTERN, f'version = "{v}"', t, count=1, flags=re.MULTILINE)
131132
p.write_text(new_t, encoding="utf-8")
132133
PY
133134
echo "tombstones/pypi/pyproject.toml → $VERSION"
@@ -138,13 +139,10 @@ jobs:
138139
v = os.environ["VERSION"]
139140
p = pathlib.Path("tombstones/vscode/CHANGELOG.md")
140141
text = p.read_text(encoding="utf-8")
141-
new_text = re.sub(
142-
r"^## \[\d+\.\d+\.\d+\] - (?:YYYY-MM-DD|\d{4}-\d{2}-\d{2})",
143-
f"## [{v}] - YYYY-MM-DD",
144-
text, count=1, flags=re.MULTILINE,
145-
)
146-
if new_text == text:
147-
raise SystemExit("::error::tombstones/vscode/CHANGELOG.md heading was not updated; check the regex anchor.")
142+
PATTERN = r"^## \[\d+\.\d+\.\d+\] - (?:YYYY-MM-DD|\d{4}-\d{2}-\d{2})"
143+
if not re.search(PATTERN, text, flags=re.MULTILINE):
144+
raise SystemExit("::error::tombstones/vscode/CHANGELOG.md heading regex anchor not found.")
145+
new_text = re.sub(PATTERN, f"## [{v}] - YYYY-MM-DD", text, count=1, flags=re.MULTILINE)
148146
p.write_text(new_text, encoding="utf-8")
149147
PY
150148
echo "tombstones/vscode/CHANGELOG.md → [$VERSION] (date sentinel preserved)"

0 commit comments

Comments
 (0)