From 51f1706e1c146461416aa10ea64f1b702e1eaf88 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Mon, 14 Sep 2026 15:34:33 +0200 Subject: [PATCH] refactored to only read current section --- .github/workflows/pr_release_notes.yaml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr_release_notes.yaml b/.github/workflows/pr_release_notes.yaml index 72c31520b..02234ee2a 100644 --- a/.github/workflows/pr_release_notes.yaml +++ b/.github/workflows/pr_release_notes.yaml @@ -53,17 +53,20 @@ jobs: */ const findReleaseNotesSection = (body = '') => { const sanitized = stripIgnoredContent(body || ''); - if (!sanitized) { - return ''; - } + if (!sanitized) return ''; + const match = sanitized.match( /(^|\n)#{1,6}\s*Release notes\s*\n([\s\S]*?)(?=\n#{1,6}\s+\S|\s*$)/i ); - if (!match) { - return ''; - } - const section = stripIgnoredContent(match[2] || '').trim(); - return section.length > 0 ? section : ''; + if (!match) return ''; + + let section = (match[2] || '') + .split('\n') + .filter(line => !/^#{1,6}\s+/.test(line.trim())) + .join('\n') + .trim(); + + return section; }; /**