mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +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 { RenovateConfig, mergeChildConfig } from '../../../config';
|
||||||
import { logger } from '../../../logger';
|
import { logger } from '../../../logger';
|
||||||
import { PackageFile } from '../../../manager/common';
|
|
||||||
import { platform } from '../../../platform';
|
import { platform } from '../../../platform';
|
||||||
import { BranchConfig } from '../../common';
|
import { BranchConfig } from '../../common';
|
||||||
import { ExtractResult, extract, update } from './extract-update';
|
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) {
|
if (config.baseBranches && config.baseBranches.length) {
|
||||||
logger.debug({ baseBranches: config.baseBranches }, 'baseBranches');
|
logger.debug({ baseBranches: config.baseBranches }, 'baseBranches');
|
||||||
let branches: BranchConfig[] = [];
|
|
||||||
let branchList: string[] = [];
|
|
||||||
let packageFiles: Record<string, PackageFile[]>;
|
|
||||||
for (const baseBranch of config.baseBranches) {
|
for (const baseBranch of config.baseBranches) {
|
||||||
logger.debug(`baseBranch: ${baseBranch}`);
|
logger.debug(`baseBranch: ${baseBranch}`);
|
||||||
const baseBranchConfig = mergeChildConfig(config, { baseBranch });
|
const baseBranchConfig = mergeChildConfig(config, { baseBranch });
|
||||||
|
@ -58,14 +59,15 @@ export async function extractDependencies(
|
||||||
}
|
}
|
||||||
baseBranchConfig.baseBranchSha = await platform.setBaseBranch(baseBranch);
|
baseBranchConfig.baseBranchSha = await platform.setBaseBranch(baseBranch);
|
||||||
const baseBranchRes = await extract(baseBranchConfig);
|
const baseBranchRes = await extract(baseBranchConfig);
|
||||||
branches = branches.concat(baseBranchRes.branches);
|
res.branches = res.branches.concat(baseBranchRes.branches);
|
||||||
branchList = branchList.concat(baseBranchRes.branchList);
|
res.branchList = res.branchList.concat(baseBranchRes.branchList);
|
||||||
packageFiles = baseBranchRes.packageFiles;
|
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 res;
|
||||||
return extract(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateRepo(
|
export async function updateRepo(
|
||||||
|
|
Loading…
Reference in a new issue