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 {