diff --git a/lib/workers/repository/updates/generate.spec.ts b/lib/workers/repository/updates/generate.spec.ts index a6fa8195bf381bfd1754a62ddc07778764a84b14..fdab3f042d1844b10237597d71dcd8c2b9fc8e73 100644 --- a/lib/workers/repository/updates/generate.spec.ts +++ b/lib/workers/repository/updates/generate.spec.ts @@ -915,5 +915,38 @@ describe('workers/repository/updates/generate', () => { '`1.1.1` (+1)', ]); }); + + it('merge excludeCommitPaths if appears in upgrade', () => { + const branch: BranchUpgradeConfig[] = [ + { + manager: 'some-manager', + depName: 'some-dep1', + branchName: 'some-branch', + prTitle: 'some-title', + newValue: '0.6.0', + }, + { + manager: 'some-other-manager', + depName: 'some-dep2', + branchName: 'some-branch', + prTitle: 'some-title', + newValue: '0.8.0', + excludeCommitPaths: ['some/path', 'some/other/path'], + }, + { + manager: 'some-manager-3', + depName: 'some-dep3', + branchName: 'some-branch', + prTitle: 'some-title', + newValue: '0.9.0', + excludeCommitPaths: ['some/path', 'some/other-manager/path'], + }, + ]; + const res = generateBranchConfig(branch); + const excludeCommitPaths = res.excludeCommitPaths ?? []; + expect(excludeCommitPaths.sort()).toStrictEqual( + ['some/path', 'some/other/path', 'some/other-manager/path'].sort() + ); + }); }); }); diff --git a/lib/workers/repository/updates/generate.ts b/lib/workers/repository/updates/generate.ts index 04af7f203a1bee9f7264b39ba6ead3da4130fd24..f0c746440a32e9777dc9cfba32ca75dc97064f0b 100644 --- a/lib/workers/repository/updates/generate.ts +++ b/lib/workers/repository/updates/generate.ts @@ -325,6 +325,24 @@ export function generateBranchConfig( ) ), ].filter(is.nonEmptyString); + // combine excludeCommitPaths for multiple manager experience + const hasExcludeCommitPaths = config.upgrades.some( + (u) => u.excludeCommitPaths && u.excludeCommitPaths.length > 0 + ); + if (hasExcludeCommitPaths) { + config.excludeCommitPaths = Object.keys( + config.upgrades.reduce((acc: Record<string, boolean>, upgrade) => { + if (upgrade.excludeCommitPaths) { + upgrade.excludeCommitPaths.forEach((p) => { + acc[p] = true; + }); + } + + return acc; + }, {} as Record<string, boolean>) + ); + } + config.automerge = config.upgrades.every((upgrade) => upgrade.automerge); // combine all labels config.labels = [