From d41e200e568e4aca4baee4ea1be2c1d2fa8f4ed8 Mon Sep 17 00:00:00 2001 From: Matthew Jackson <1085847+MattJackson@users.noreply.github.com> Date: Fri, 21 Aug 2026 11:23:46 -0700 Subject: [PATCH] ci: require a CHANGELOG entry for the crate version on main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a 'changelog' job that fails when Cargo.toml's version has no matching '## [X.Y.Z]' heading in CHANGELOG.md, hard on main and PRs into main, warning on dev/qa — so the unified release can't ship a crate with a blank changelog. --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ef3d05..8e55535 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,32 @@ on: # is the one release.sh regenerates in each consuming binary. jobs: + # CI owns the changelog: main may never carry a released version without a + # CHANGELOG.md entry for it. The release orchestrator dates an existing + # `## [X.Y.Z]` heading — it does NOT invent one — so a version bump that + # forgot its changelog entry must fail here rather than ship a blank release. + # Hard-fails on main (and PRs targeting main); warns elsewhere so an + # in-progress dev/qa branch whose entry isn't written yet is not blocked. + changelog: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - name: Require a CHANGELOG entry for the crate version on main + shell: bash + run: | + set -euo pipefail + version=$(grep -m1 '^version = ' Cargo.toml | sed -E 's/.*"([^"]+)".*/\1/') + if grep -qE "^## \[${version}\]" CHANGELOG.md; then + echo "CHANGELOG.md has an entry for ${version}." + exit 0 + fi + msg="CHANGELOG.md has no '## [${version}]' entry" + if [ "${GITHUB_REF_NAME:-}" = "main" ] || [ "${GITHUB_BASE_REF:-}" = "main" ]; then + echo "::error::${msg} — main requires a changelog entry for the released version." + exit 1 + fi + echo "::warning::${msg} (allowed on ${GITHUB_REF_NAME:-unknown}; required before it can reach main)." + lint: runs-on: ubuntu-latest steps: