fix(release): make changelog promote idempotent (no duplicate version headers)
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 21s

The promote step unconditionally inserted "## [version]" after "## [Unreleased]"
on every build, so repeated or same-version releases produced empty, duplicated
version headers (e.g. two "## [02.56.07]"). Guard the insert on the version
header not already being present.

Local stopgap; the same fix is needed in the template auto-release.yml
(tracked in Template-Generic).

Claude-Session: https://claude.ai/code/session_01WbGBN9VyRK61zczYWcCQ2i
This commit is contained in:
2026-07-05 17:20:37 -05:00
parent ec3094385f
commit 5175ab9d5b
2 changed files with 10 additions and 4 deletions
+7 -4
View File
@@ -380,10 +380,13 @@ jobs:
import sys
version, date = sys.argv[1], sys.argv[2]
content = open('CHANGELOG.md').read()
old = '## [Unreleased]'
new = f'## [Unreleased]\n\n## [{version}] --- {date}'
content = content.replace(old, new, 1)
open('CHANGELOG.md', 'w').write(content)
marker = f'## [{version}]'
# Idempotent: only promote when this version header isn't already present,
# otherwise re-runs (or same-version builds) create empty duplicate headers.
if marker not in content:
new = f'## [Unreleased]\n\n{marker} --- {date}'
content = content.replace('## [Unreleased]', new, 1)
open('CHANGELOG.md', 'w').write(content)
" "$VERSION" "$DATE"
git add CHANGELOG.md
git commit -m "chore: promote changelog [Unreleased] → [${VERSION}]" || true
+3
View File
@@ -1,6 +1,9 @@
# Changelog
## [Unreleased]
### Fixed
- Release automation: the changelog-promote step is now idempotent — it only inserts a `## [version]` header when that version isn't already present, preventing the empty, duplicated version headers that repeated/same-version builds were producing. (workflow)
## [02.56.08] --- 2026-07-05
## [02.56.08] --- 2026-07-05