diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bcbf22e..ccf1a672 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [7.5.1](https://github.com/nodejs/node-core-utils/compare/v7.5.0...v7.5.1) (2026-10-15) + + +### Bug Fixes + +* **ncu-ci:** only filter `main` branch when it's the only one ([78f6452](https://github.com/nodejs/node-core-utils/commit/78f645217fccec70a03fabc251088845acfa5bb3)) + ## [7.5.0](https://github.com/nodejs/node-core-utils/compare/v7.4.1...v7.5.0) (2026-10-15) diff --git a/lib/ci/failure_aggregator.js b/lib/ci/failure_aggregator.js index 9f94b39e..5355eeed 100644 --- a/lib/ci/failure_aggregator.js +++ b/lib/ci/failure_aggregator.js @@ -28,12 +28,14 @@ function formatTargetBranches(pr, markdown = false) { if (!parsePRFromURL(pr.source)) { return ''; } - const branches = pr.targetBranches - .filter(branch => branch !== 'main') - .map(branch => markdown - ? branch.replace(/[&<>"'\\`*_[\]{}()!|~]/g, char => `&#${char.charCodeAt(0)};`) - : branch); - return branches.length ? ` (target: ${branches.join(', ')})` : ''; + if (pr.targetBranches.length === 1 && pr.targetBranches[0] === 'main') { + return ''; + } + const branches = markdown + ? pr.targetBranches.map(branch => + branch.replace(/[&<>"'\\`*_[\]{}()!|~]/g, char => `&#${char.charCodeAt(0)};`)) + : pr.targetBranches; + return ` (target: ${branches.join(', ')})`; } export class FailureAggregator { diff --git a/package-lock.json b/package-lock.json index 2deb7d0c..a19d4e43 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@node-core/utils", - "version": "7.5.0", + "version": "7.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@node-core/utils", - "version": "7.5.0", + "version": "7.5.1", "bundleDependencies": [ "@inquirer/prompts", "@listr2/prompt-adapter-inquirer", diff --git a/package.json b/package.json index 9c8fb2bc..5299409b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@node-core/utils", - "version": "7.5.0", + "version": "7.5.1", "description": "Utilities for Node.js core collaborators", "type": "module", "engines": { diff --git a/test/unit/ci_failure_aggregator.test.js b/test/unit/ci_failure_aggregator.test.js index 043db40a..f011b25c 100644 --- a/test/unit/ci_failure_aggregator.test.js +++ b/test/unit/ci_failure_aggregator.test.js @@ -46,7 +46,7 @@ describe('Failure aggregation target branches', () => { const markdown = aggregator.formatAsMarkdown(); assert.ok(markdown.includes('| Failed PR | 2 (' + `[nodejs/node#2](${failures[3].upstream}) (target: v22.x), ` + - `[nodejs/node#1](${failures[0].upstream}) (target: v24.x)) |`)); + `[nodejs/node#1](${failures[0].upstream}) (target: main, v24.x)) |`)); assert.ok(markdown.includes(`| First CI | ${failures[3].upstream} |`)); assert.ok(markdown.includes(`| Last CI | ${failures[0].upstream} |`)); assert.ok(markdown.includes('Health summary\n')); @@ -55,7 +55,7 @@ describe('Failure aggregation target branches', () => { aggregator.display(); assert.deepEqual(cli._calls.table.filter(([key]) => key === 'Failed PR'), [ - ['Failed PR', '2 (nodejs/node#2 (target: v22.x), nodejs/node#1 (target: v24.x))'], + ['Failed PR', '2 (nodejs/node#2 (target: v22.x), nodejs/node#1 (target: main, v24.x))'], ['Failed PR', '1 (nodejs/node#3)'] ]); }); @@ -66,16 +66,18 @@ describe('Failure aggregation target branches', () => { failure(1, 104), failure(1, 103, 'main'), failure(1, 102), failure(2, 101) ]); const markdown = aggregator.formatAsMarkdown(); - assert.equal(markdown.includes('target: unknown, main'), false); + assert.ok(markdown.includes('(target: unknown, main)')); assert.ok(markdown.includes('(target: unknown)')); aggregator.display(); assert.deepEqual(cli._calls.table.find(([key]) => key === 'Failed PR'), - ['Failed PR', '2 (nodejs/node#2 (target: unknown), nodejs/node#1 (target: unknown))']); + ['Failed PR', '2 (nodejs/node#2 (target: unknown), nodejs/node#1 (target: unknown, main))']); }); - it('hides main targets and abbreviates PR labels without changing CI links', () => { + it('hides sole main targets and abbreviates PR labels without changing CI links', () => { const cli = new TestCLI(); - const failures = [failure(1, 102, 'main'), failure(2, 101, 'main')]; + const failures = [ + failure(1, 102, 'main'), failure(2, 101, 'main'), failure(1, 100, 'main') + ]; failures[1].source = 'https://github.com/nodejs-private/node-private/pull/2/'; const aggregator = new FailureAggregator(cli, [health, ...failures]); const markdown = aggregator.formatAsMarkdown();