From 533c65cca9efc86314b3db0aaf227f8fefbe793c Mon Sep 17 00:00:00 2001 From: Roman Kivalin Date: Sat, 18 Apr 2026 00:16:20 +0200 Subject: [PATCH] Fix changelog extraction stripping non-empty section headers The sed-based empty section filter removed all ### headers followed by a blank line, but our format always has a blank line between the header and content. Replace with awk that collects each section and only prints it if it has content. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/release.yaml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a4b0a3a..9f6b352 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -126,9 +126,19 @@ jobs: - name: Extract changelog run: | VERSION=${GITHUB_REF_NAME#v} + # Extract content for this version, strip empty sections, trim trailing blanks sed -n "/^## ${VERSION} /,/^## [0-9]/{/^## [0-9]/d;p}" CHANGELOG.md \ - | sed '/^### .*/{N;/\n$/d}' \ - | sed -e :a -e '/^\n*$/{$d;N;ba}' -e '/^$/N;/\n$/ba' \ + | awk ' + BEGIN { header=""; body="" } + /^### / { + if (header != "" && body != "") printf "%s\n\n%s", header, body + header = $0; body = "" + next + } + /^- / || /^ / { body = body $0 "\n"; next } + /^$/ { if (body != "") body = body "\n" } + END { if (header != "" && body != "") printf "%s\n\n%s", header, body } + ' | sed -e :a -e '/^\n*$/{$d;N;ba}' \ >/tmp/release-notes.md - name: Create release