mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
refactor: baseBranches fetching
This commit is contained in:
parent
a47c69f8a5
commit
010df05800
1 changed files with 12 additions and 10 deletions
|
@ -1,6 +1,5 @@
|
|||
import { RenovateConfig, mergeChildConfig } from '../../../config';
|
||||
import { logger } from '../../../logger';
|
||||
import { PackageFile } from '../../../manager/common';
|
||||
import { platform } from '../../../platform';
|
||||
import { BranchConfig } from '../../common';
|
||||
import { ExtractResult, extract, update } from './extract-update';
|
||||
|
@ -44,11 +43,13 @@ export async function extractDependencies(
|
|||
}
|
||||
}
|
||||
}
|
||||
let res: ExtractResult = {
|
||||
branches: [],
|
||||
branchList: [],
|
||||
packageFiles: null,
|
||||
};
|
||||
if (config.baseBranches && config.baseBranches.length) {
|
||||
logger.debug({ baseBranches: config.baseBranches }, 'baseBranches');
|
||||
let branches: BranchConfig[] = [];
|
||||
let branchList: string[] = [];
|
||||
let packageFiles: Record<string, PackageFile[]>;
|
||||
for (const baseBranch of config.baseBranches) {
|
||||
logger.debug(`baseBranch: ${baseBranch}`);
|
||||
const baseBranchConfig = mergeChildConfig(config, { baseBranch });
|
||||
|
@ -58,14 +59,15 @@ export async function extractDependencies(
|
|||
}
|
||||
baseBranchConfig.baseBranchSha = await platform.setBaseBranch(baseBranch);
|
||||
const baseBranchRes = await extract(baseBranchConfig);
|
||||
branches = branches.concat(baseBranchRes.branches);
|
||||
branchList = branchList.concat(baseBranchRes.branchList);
|
||||
packageFiles = baseBranchRes.packageFiles;
|
||||
res.branches = res.branches.concat(baseBranchRes.branches);
|
||||
res.branchList = res.branchList.concat(baseBranchRes.branchList);
|
||||
res.packageFiles = res.packageFiles || baseBranchRes.packageFiles; // Use the first branch
|
||||
}
|
||||
return { branches, branchList, packageFiles };
|
||||
} else {
|
||||
logger.debug('No baseBranches');
|
||||
res = await extract(config);
|
||||
}
|
||||
logger.debug('No baseBranches');
|
||||
return extract(config);
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function updateRepo(
|
||||
|
|
Loading…
Reference in a new issue