From 067b7fbc0d31d79a53978bc0a950634bd99c458b Mon Sep 17 00:00:00 2001 From: Zack Whitson Date: Fri, 7 Aug 2026 12:56:43 -0500 Subject: [PATCH] Guard the changelog entry, not the composed release note The emptiness check ran after the install section had already been appended inside the same redirect group, so release-notes.md always had content and the guard could never fire. A version missing its changelog entry would have published a release note containing nothing but install instructions. The extraction now writes its own file and is tested before composition. Verified both directions: an existing version composes notes with exactly one install section and exits 0; a version absent from the changelog exits 1 with the intended message. Co-Authored-By: Claude Fable 5 --- .github/workflows/release.yml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d35c61..8cbac52 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -82,13 +82,23 @@ jobs: # commit subjects. `--generate-notes` on a repo whose only commit per # release is "Release CodeTruss CLI vX" produces a note that says # nothing a reader did not already know from the title. - { - awk -v ver="## $VERSION " ' - index($0, ver) == 1 { found = 1; next } - found && /^## / { exit } - found { print } - ' CHANGELOG.md + awk -v ver="## $VERSION " ' + index($0, ver) == 1 { found = 1; next } + found && /^## / { exit } + found { print } + ' CHANGELOG.md > changelog-entry.md + + # Guard the EXTRACTED ENTRY, not the composed file. The install section + # below is written unconditionally, so a check after composition can + # never fail, and a version missing its changelog entry would publish a + # release note containing nothing but install steps. + if [ ! -s changelog-entry.md ]; then + echo "No changelog entry found for $VERSION; refusing to publish an empty release note." >&2 + exit 1 + fi + { + cat changelog-entry.md cat < release-notes.md - if [ ! -s release-notes.md ]; then - echo "No changelog entry found for $VERSION; refusing to publish an empty release note." >&2 - exit 1 - fi - gh release create "$GITHUB_REF_NAME" \ --draft \ --verify-tag \