Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
14 changes: 8 additions & 6 deletions lib/ci/failure_aggregator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
14 changes: 8 additions & 6 deletions test/unit/ci_failure_aggregator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand All @@ -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)']
]);
});
Expand All @@ -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();
Expand Down