From 20c5f552920fc860bbcce91891ca8ddaadcd9181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Irving=20Mondrag=C3=B3n?= Date: Sun, 23 Aug 2026 02:25:55 +0200 Subject: [PATCH] Fix release notes linter failing on LF-only and multi-line PR bodies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The release-note regex required CRLF line endings and a single-line note, so PRs whose body uses LF (created via the API or gh CLI) or whose note spans several lines (e.g. "action required" followed by a list) failed even with a valid block. Strip CRs before matching so both styles are accepted, allow multi-line notes while still requiring at least one non-blank line, drop the stale template check that no longer matches the PR template text, and fetch the PR body once. Signed-off-by: Irving Mondragón --- .github/workflows/release-notes-linter.yaml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-notes-linter.yaml b/.github/workflows/release-notes-linter.yaml index e42fb3f36..098ab1142 100644 --- a/.github/workflows/release-notes-linter.yaml +++ b/.github/workflows/release-notes-linter.yaml @@ -18,18 +18,13 @@ jobs: # Validate PR release notes echo "Going to validate PR ${PR_NUMBER}" - echo "First making sure you have not left the PR template as is" - # Describe any user facing changes here, or delete this block. - TEMPLATE_LEFT_AS_IS=$(wget -q -O- https://api.github.com/repos/shipwright-io/cli/pulls/${PR_NUMBER} | jq '.body | match("(Describe any user facing changes here, or delete this block)")') - if [ -z "${TEMPLATE_LEFT_AS_IS}" ]; then - echo "You appear to have attempted to update the PR template to define a release note." - else - echo "You have not made any changes for release notes in your PR description. Edit your PR description per the instructions at https://raw.githubusercontent.com/shipwright-io/cli/main/.github/pull_request_template.md" - exit 1 - fi + PR_BODY=$(wget -q -O- https://api.github.com/repos/shipwright-io/cli/pulls/${PR_NUMBER} | jq '.body') echo "Now checking against valid structure for release notes" - MATCHES=$(wget -q -O- https://api.github.com/repos/shipwright-io/cli/pulls/${PR_NUMBER} | jq '.body | match("(```release-note\r\n(.*|NONE|action required: .*)\r\n```)")') + # Strip CR so the match works for both CRLF (web UI) and LF (API, gh CLI) bodies. + # The block must contain at least one non-blank line and may span multiple lines + # (e.g. "action required" followed by a bullet list). + MATCHES=$(echo "${PR_BODY}" | jq 'gsub("\r"; "") | match("```release-note\n(.*[^[:space:]].*\n(?:.*\n)*?)```")') if [ -z "${MATCHES}" ]; then echo "Your Release Notes were not properly defined or they are not in place, please make sure you add them." echo "See our PR template for more information: https://raw.githubusercontent.com/shipwright-io/cli/main/.github/pull_request_template.md"