From 60a342fdac3a29ac20d7b57ab43e4d244c1b6ae3 Mon Sep 17 00:00:00 2001 From: bompus Date: Fri, 6 Nov 2026 11:01:37 -0700 Subject: [PATCH] Publish only when the first CHANGELOG heading is this version CHANGELOG.md ships in the package, and the 1.0.2 and 1.0.3 tarballs carry an empty "## Unreleased" heading above their own entry. The publish workflow now stops before "npm publish" unless the first "## " heading in CHANGELOG.md is "## - YYYY-MM-DD". --- .github/workflows/publish.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8120b74..11f5bd4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,6 +29,15 @@ jobs: run: test "v$(node -p "require('./package.json').version")" = "$GITHUB_REF_NAME" - name: Tag commit is on main run: git merge-base --is-ancestor "$GITHUB_SHA" origin/main + # CHANGELOG.md ships in the package, so its newest entry must be this version, not a leftover Unreleased heading. + - name: Changelog's newest entry is this version + run: | + version=$(node -p "require('./package.json').version") + first=$(grep -m1 '^## ' CHANGELOG.md || true) + case "$first" in + "## $version - "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]) echo "ok: $first" ;; + *) echo "::error::first CHANGELOG.md heading is '$first', expected '## $version - YYYY-MM-DD'"; exit 1 ;; + esac - name: Benchmarks were re-run on this code run: node bench/check-benchmarked.mjs # bun run build bundles dist/ with bun build, pinned so every build makes the same dist/