renovate/lib/workers/repository/config-migration/index.ts
Gabriel-Ladzaretti 70a49def74
refactor(repo/config-migration): use cached raw config file from detectRepoFileConfig (#17311)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-08-29 20:08:35 +00:00

22 lines
753 B
TypeScript

import type { RenovateConfig } from '../../../config/types';
import { checkConfigMigrationBranch } from './branch';
import { MigratedDataFactory } from './branch/migrated-data';
import { ensureConfigMigrationPr } from './pr';
export async function configMigration(
config: RenovateConfig,
branchList: string[]
): Promise<void> {
if (config.configMigration) {
const migratedConfigData = await MigratedDataFactory.getAsync();
const migrationBranch = await checkConfigMigrationBranch(
config,
migratedConfigData
); // null if migration not needed
if (migrationBranch) {
branchList.push(migrationBranch);
await ensureConfigMigrationPr(config, migratedConfigData!);
}
MigratedDataFactory.reset();
}
}