Commit 9a2046e1982 for nodejs

commit 9a2046e198268a06ae7a1ca4ee4d1d9aa39d0a59
Author: Antoine du Hamel <duhamelantoine1995@gmail.com>
Date:   Sun Nov 22 19:43:21 2026 +0100

    tools: avoid early exit in release proposal linter

    The current script exits at the first error, instead of listing all the
    errors to fix.

    Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
    PR-URL: https://github.com/nodejs/node/pull/67666
    Reviewed-By: Ruy Adorno <ruy@vlt.sh>
    Reviewed-By: Tierney Cyren <hello@bnb.im>
    Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>

diff --git a/.github/workflows/lint-release-proposal.yml b/.github/workflows/lint-release-proposal.yml
index 989a57cd885..3ab7ab2c1af 100644
--- a/.github/workflows/lint-release-proposal.yml
+++ b/.github/workflows/lint-release-proposal.yml
@@ -92,19 +92,23 @@ jobs:
       - name: Validate CHANGELOG
         id: releaser-info
         run: |
+          HAS_ERROR=
           EXPECTED_CHANGELOG_TITLE_INTRO="## $COMMIT_SUBJECT, @"
           echo "Expected CHANGELOG section title: $EXPECTED_CHANGELOG_TITLE_INTRO"
           CHANGELOG_PATH="doc/changelogs/CHANGELOG_V${MAJOR}.md"
-          CHANGELOG_TITLE="$(grep "$EXPECTED_CHANGELOG_TITLE_INTRO" "$CHANGELOG_PATH")"
+          CHANGELOG_TITLE="$(grep "$EXPECTED_CHANGELOG_TITLE_INTRO" "$CHANGELOG_PATH" || true)"
           echo "Actual: $CHANGELOG_TITLE"
-          [ "${CHANGELOG_TITLE%%@*}@" = "$EXPECTED_CHANGELOG_TITLE_INTRO" ]
+          if [ "${CHANGELOG_TITLE%%@*}@" != "$EXPECTED_CHANGELOG_TITLE_INTRO" ]; then
+            echo "::error file=$CHANGELOG_PATH,title=Release proposal linter::Cannot find CHANGELOG section title starting with $EXPECTED_CHANGELOG_TITLE_INTRO"
+            HAS_ERROR=1
+          fi
           gh api \
             -H "Accept: application/vnd.github+json" \
             -H "X-GitHub-Api-Version: 2022-11-28" \
             --jq '.commits.[] | { smallSha: .sha[0:10] } + (.commit.message|capture("^(?<title>.+)\n\n(.*\n)*PR-URL: (?<prURL>.+)(\n|$)"))' \
             "/repos/${GITHUB_REPOSITORY}/compare/v${MAJOR}.x...$GITHUB_SHA" --paginate \
           | node tools/actions/lint-release-proposal-commit-list.mjs "$CHANGELOG_PATH" "$GITHUB_SHA" \
-          | while IFS= read -r PR_URL; do
+          | { while IFS= read -r PR_URL; do
             DONT_LAND_LABEL="dont-land-on-v${MAJOR}.x" LTS_WATCH_LABEL="lts-watch-v${MAJOR}.x" gh pr view \
               --json labels,url \
               --jq '
@@ -114,8 +118,9 @@ jobs:
                   error("\(.url) has the \(env.LTS_WATCH_LABEL) label, please remove the label now that the PR is included in a release proposal")
                 end
                 ' \
-              "$PR_URL" > /dev/null
-          done
+              "$PR_URL" > /dev/null || HAS_LABEL_ERROR=1
+          done; [ -z "$HAS_LABEL_ERROR" ]; } || HAS_ERROR=1
+          [ -z "$HAS_ERROR" ]
         shell: bash  # See https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference, we want the pipefail option.
         env:
           COMMIT_SUBJECT: ${{ steps.commit-message-parse.outputs.COMMIT_SUBJECT }}
diff --git a/tools/actions/lint-release-proposal-commit-list.mjs b/tools/actions/lint-release-proposal-commit-list.mjs
index fa5ebf79cdf..701c76aca66 100755
--- a/tools/actions/lint-release-proposal-commit-list.mjs
+++ b/tools/actions/lint-release-proposal-commit-list.mjs
@@ -46,19 +46,40 @@ commitList = commitList

 let expectedNumberOfCommitsLeft = commitList.match(/\n\* \[/g)?.length ?? 0;

+function reportError(message, lineStart = -1) {
+  let annotation = `file=${CHANGELOG_PATH}`;
+  if (lineStart !== -1) {
+    let line = 1;
+    for (let i = 0; i < lineStart + commitListingStart; i = changelog.indexOf('\n', i + 1)) {
+      line++;
+    }
+    annotation += `,line=${line}`;
+  }
+  console.error(`::error ${annotation},title=Release proposal linter::${message}`);
+  process.exitCode ||= 1;
+}
+
 for await (const line of stdinLineByLine) {
   const { smallSha, title, prURL } = JSON.parse(line);

   if (smallSha === RELEASE_COMMIT_SHA.slice(0, 10)) {
-    assert.strictEqual(
-      expectedNumberOfCommitsLeft, 0,
-      'Some commits are listed without being included in the proposal, or are listed more than once',
-    );
+    if (expectedNumberOfCommitsLeft !== 0) {
+      reportError('Some commits are listed without being included in the proposal, or are listed more than once');
+      // Avoid reporting the same discrepancy again after the loop.
+      expectedNumberOfCommitsLeft = 0;
+    }
     continue;
   }

+  // Used by the wrapping shell (in lint-release-proposal.yml) to check to labels
+  console.log(prURL);
+
   const lineStart = commitList.indexOf(`\n* [[\`${smallSha}\`]`);
-  assert.notStrictEqual(lineStart, -1, `Cannot find ${smallSha} on the list`);
+  if (lineStart === -1) {
+    reportError(`Cannot find ${smallSha} on the list`);
+    continue;
+  }
+  expectedNumberOfCommitsLeft--;
   const lineEnd = commitList.indexOf('\n', lineStart + 1);

   try {
@@ -80,15 +101,10 @@ for await (const line of stdinLineByLine) {
     if (e?.code !== 'ERR_ASSERTION') {
       throw e;
     }
-    let line = 1;
-    for (let i = 0; i < lineStart + commitListingStart; i = changelog.indexOf('\n', i + 1)) {
-      line++;
-    }
-    console.error(`::error file=${CHANGELOG_PATH},line=${line},title=Release proposal linter::${e.message}`);
+    reportError(e.message, lineStart);
     console.error(e);
-    process.exitCode ||= 1;
   }
-  expectedNumberOfCommitsLeft--;
-  console.log(prURL);
 }
-assert.strictEqual(expectedNumberOfCommitsLeft, 0, 'Release commit is not the last commit in the proposal');
+if (expectedNumberOfCommitsLeft !== 0) {
+  reportError('Release commit is not the last commit in the proposal');
+}