diff --git a/lib/workers/branch/index.ts b/lib/workers/branch/index.ts index 12b80646b0a4cd2b7ce4887e5fe720714e62f029..f85663bee082f29fc9f13106e869f14731deb216 100644 --- a/lib/workers/branch/index.ts +++ b/lib/workers/branch/index.ts @@ -22,10 +22,7 @@ import { PR_STATE_OPEN, } from '../../constants/pull-requests'; import { logger } from '../../logger'; -import { - AdditionalPackageFiles, - getAdditionalFiles, -} from '../../manager/npm/post-update'; +import { getAdditionalFiles } from '../../manager/npm/post-update'; import { platform } from '../../platform'; import { BranchStatus } from '../../types'; import { emojify } from '../../util/emoji'; @@ -55,8 +52,7 @@ function rebaseCheck(config: RenovateConfig, branchPr: any): boolean { export async function processBranch( branchConfig: BranchConfig, - prHourlyLimitReached?: boolean, - packageFiles?: AdditionalPackageFiles + prHourlyLimitReached?: boolean ): Promise<ProcessBranchResult> { const config: BranchConfig = { ...branchConfig }; const dependencies = config.upgrades @@ -303,7 +299,10 @@ export async function processBranch( } else { logger.debug('No package files need updating'); } - const additionalFiles = await getAdditionalFiles(config, packageFiles); + const additionalFiles = await getAdditionalFiles( + config, + branchConfig.packageFiles + ); config.artifactErrors = (config.artifactErrors || []).concat( additionalFiles.artifactErrors ); diff --git a/lib/workers/common.ts b/lib/workers/common.ts index 051c3b4721b1379fc6c3bbe6f3cd5f68c307a118..53eec7aefacd2159745bf7b9c6caab3e5a2a9c5b 100644 --- a/lib/workers/common.ts +++ b/lib/workers/common.ts @@ -10,6 +10,7 @@ import { ArtifactError, LookupUpdate, PackageDependency, + PackageFile, } from '../manager/common'; import { File, PlatformPrOptions } from '../platform'; import { ChangeLogResult } from './pr/changelog/common'; @@ -95,4 +96,5 @@ export interface BranchConfig res?: ProcessBranchResult; upgrades: BranchUpgradeConfig[]; + packageFiles?: Record<string, PackageFile[]>; } diff --git a/lib/workers/repository/index.ts b/lib/workers/repository/index.ts index 2d4bfc332245f13603d3102f54f524c55f46a065..468da70d7fa023ca222489f40f76f470a713fa38 100644 --- a/lib/workers/repository/index.ts +++ b/lib/workers/repository/index.ts @@ -33,7 +33,7 @@ export async function renovateRepository( config = await initRepo(config); const { branches, branchList, packageFiles } = await processRepo(config); await ensureOnboardingPr(config, packageFiles, branches); - const res = await updateRepo(config, branches, branchList, packageFiles); + const res = await updateRepo(config, branches, branchList); if (res !== 'automerged') { await ensureMasterIssue(config, branches); } diff --git a/lib/workers/repository/process/extract-update.spec.ts b/lib/workers/repository/process/extract-update.spec.ts index 02a007da87fa77b1650bf74d7d956289b420a139..a090e48360a153b35b4cd6f2ea59dd066d909ac4 100644 --- a/lib/workers/repository/process/extract-update.spec.ts +++ b/lib/workers/repository/process/extract-update.spec.ts @@ -11,8 +11,8 @@ jest.mock('../extract'); const branchify = mocked(_branchify); branchify.branchifyUpgrades.mockResolvedValueOnce({ - branches: [], - branchList: [], + branches: [{ branchName: 'some-branch', upgrades: [] }], + branchList: ['branchName'], }); describe('workers/repository/process/extract-update', () => { @@ -23,7 +23,7 @@ describe('workers/repository/process/extract-update', () => { suppressNotifications: ['deprecationWarningIssues'], }; const res = await extract(config); - await update(config, res.branches, res.branchList, res.packageFiles); + await update(config, res.branches); }); }); }); diff --git a/lib/workers/repository/process/extract-update.ts b/lib/workers/repository/process/extract-update.ts index b446cfc52ef183ba4575fc2f177c18a99e24bf2b..0f5e45afad44c46173098324b51f6d1e227c7254 100644 --- a/lib/workers/repository/process/extract-update.ts +++ b/lib/workers/repository/process/extract-update.ts @@ -64,14 +64,12 @@ export async function extract(config: RenovateConfig): Promise<ExtractResult> { export async function update( config: RenovateConfig, - branches: BranchConfig[], - branchList: string[], - packageFiles: Record<string, PackageFile[]> + branches: BranchConfig[] ): Promise<WriteUpdateResult | undefined> { let res: WriteUpdateResult | undefined; // istanbul ignore else if (config.repoIsOnboarded) { - res = await writeUpdates(config, packageFiles, branches); + res = await writeUpdates(config, branches); } return res; diff --git a/lib/workers/repository/process/index.spec.ts b/lib/workers/repository/process/index.spec.ts index 67a8045ed6f4c585e9dd868ab22939c9a2c0f4fa..f89830223b6b9962b57c2495c6c3a0bcb06dd4b6 100644 --- a/lib/workers/repository/process/index.spec.ts +++ b/lib/workers/repository/process/index.spec.ts @@ -22,7 +22,7 @@ describe('workers/repository/process/index', () => { extract.mockResolvedValue({} as never); config.baseBranches = ['branch1', 'branch2']; const res = await processRepo(config); - await updateRepo(config, res.branches, res.branchList, res.packageFiles); + await updateRepo(config, res.branches, res.branchList); expect(res).toMatchSnapshot(); }); }); diff --git a/lib/workers/repository/process/index.ts b/lib/workers/repository/process/index.ts index b28502d38908d86c856a12934ec68e896cbf8d9e..6b986d2e9699f547b5a5119fc86a35e5b75b5883 100644 --- a/lib/workers/repository/process/index.ts +++ b/lib/workers/repository/process/index.ts @@ -71,10 +71,9 @@ export async function processRepo( export async function updateRepo( config: RenovateConfig, branches: BranchConfig[], - branchList: string[], - packageFiles?: Record<string, PackageFile[]> + branchList: string[] ): Promise<WriteUpdateResult | undefined> { logger.debug('processRepo()'); - return update(config, branches, branchList, packageFiles); + return update(config, branches); } diff --git a/lib/workers/repository/process/write.spec.ts b/lib/workers/repository/process/write.spec.ts index e80a5212cb3783cbd0ee29615cc127234624be3b..3fdb37d395b41afa64e69dae9656d08db6f922b6 100644 --- a/lib/workers/repository/process/write.spec.ts +++ b/lib/workers/repository/process/write.spec.ts @@ -19,14 +19,13 @@ beforeEach(() => { describe('workers/repository/write', () => { describe('writeUpdates()', () => { - const packageFiles = {}; it('skips branches blocked by pin', async () => { const branches: BranchConfig[] = [ { updateType: 'pin' }, { blockedByPin: true }, {}, ] as never; - const res = await writeUpdates(config, packageFiles, branches); + const res = await writeUpdates(config, branches); expect(res).toEqual('done'); expect(branchWorker.processBranch).toHaveBeenCalledTimes(2); }); @@ -35,7 +34,7 @@ describe('workers/repository/write', () => { branchWorker.processBranch.mockResolvedValueOnce('pr-created'); branchWorker.processBranch.mockResolvedValueOnce('already-existed'); branchWorker.processBranch.mockResolvedValueOnce('automerged'); - const res = await writeUpdates(config, packageFiles, branches); + const res = await writeUpdates(config, branches); expect(res).toEqual('automerged'); expect(branchWorker.processBranch).toHaveBeenCalledTimes(3); }); diff --git a/lib/workers/repository/process/write.ts b/lib/workers/repository/process/write.ts index 97ebdb9036a189dc08b29f9c831a922b0cc94959..28d0af9826c5adbb04240c351a31d22414d99132 100644 --- a/lib/workers/repository/process/write.ts +++ b/lib/workers/repository/process/write.ts @@ -1,7 +1,5 @@ import { RenovateConfig } from '../../../config'; import { addMeta, logger, removeMeta } from '../../../logger'; -import { PackageFile } from '../../../manager/common'; -import { AdditionalPackageFiles } from '../../../manager/npm/post-update'; import { processBranch } from '../../branch'; import { BranchConfig } from '../../common'; import { getLimitRemaining } from '../../global/limits'; @@ -11,7 +9,6 @@ export type WriteUpdateResult = 'done' | 'automerged'; export async function writeUpdates( config: RenovateConfig, - packageFiles: Record<string, PackageFile[]> | AdditionalPackageFiles, allBranches: BranchConfig[] ): Promise<WriteUpdateResult> { let branches = allBranches; @@ -35,8 +32,7 @@ export async function writeUpdates( addMeta({ branch: branch.branchName }); const res = await processBranch( branch, - prsRemaining <= 0 || getLimitRemaining('prCommitsPerRunLimit') <= 0, - packageFiles + prsRemaining <= 0 || getLimitRemaining('prCommitsPerRunLimit') <= 0 ); branch.res = res; if (res === 'automerged' && config.automergeType !== 'pr-comment') { diff --git a/lib/workers/repository/updates/branchify.ts b/lib/workers/repository/updates/branchify.ts index c7bdbc7e6e27d85834c7c3fc55c67ee12d619b82..06a302b97d8621316cc2a7475b29729246e4f871 100644 --- a/lib/workers/repository/updates/branchify.ts +++ b/lib/workers/repository/updates/branchify.ts @@ -150,6 +150,7 @@ export async function branchifyUpgrades( ); const branch = generateBranchConfig(branchUpgrades[branchName]); branch.branchName = branchName; + branch.packageFiles = packageFiles; branches.push(branch); } removeMeta(['branch']);