From dcd37c298dcaa59d1f98836c47f6597d9b536c3d Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 15 Oct 2026 11:17:47 +0200 Subject: [PATCH] fix(ncu-ci): only filter `main` branch when it's the only one --- lib/ci/failure_aggregator.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/ci/failure_aggregator.js b/lib/ci/failure_aggregator.js index 9f94b39e..4105eb1c 100644 --- a/lib/ci/failure_aggregator.js +++ b/lib/ci/failure_aggregator.js @@ -24,16 +24,18 @@ function formatSource(source) { return parsed ? `${parsed.owner}/${parsed.repo}#${parsed.prid}` : source; } -function formatTargetBranches(pr, markdown = false) { - if (!parsePRFromURL(pr.source)) { +function formatTargetBranches({ source, targetBranches }, markdown = false) { + if (!parsePRFromURL(source) || (targetBranches.length === 1 && targetBranches[0] === 'main')) { return ''; } - const branches = pr.targetBranches - .filter(branch => branch !== 'main') + if (targetBranches.length === 0) { + return ' (target: none)'; + } + const branches = targetBranches .map(branch => markdown ? branch.replace(/[&<>"'\\`*_[\]{}()!|~]/g, char => `&#${char.charCodeAt(0)};`) : branch); - return branches.length ? ` (target: ${branches.join(', ')})` : ''; + return ` (target: ${branches.join(', ')})`; } export class FailureAggregator {