aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahulGautamSingh <[email protected]>2024-12-16 11:34:22 +0530
committerGitHub <[email protected]>2024-12-16 06:04:22 +0000
commit66dcb61908dfdbc262c0d61861145a6e8240f312 (patch)
tree00d15926e2ad131c55345cbaabe604bd62785576
parent8453d73d0bd385673c2c5174a76f43191906a249 (diff)
downloadrenovate-66dcb61908dfdbc262c0d61861145a6e8240f312.tar.gz
renovate-66dcb61908dfdbc262c0d61861145a6e8240f312.zip
fix(config-migration): skip migration of package.json (#33122)39.69.3
-rw-r--r--lib/workers/repository/config-migration/index.spec.ts13
-rw-r--r--lib/workers/repository/config-migration/index.ts8
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/workers/repository/config-migration/index.spec.ts b/lib/workers/repository/config-migration/index.spec.ts
index 19ae2263eeb..11fa18a7558 100644
--- a/lib/workers/repository/config-migration/index.spec.ts
+++ b/lib/workers/repository/config-migration/index.spec.ts
@@ -46,6 +46,19 @@ describe('workers/repository/config-migration/index', () => {
expect(ensureConfigMigrationPr).toHaveBeenCalledTimes(0);
});
+ it('skips pr creation if config found in package.json', async () => {
+ const branchList: string[] = [];
+ mockedFunction(MigratedDataFactory.getAsync).mockResolvedValue({
+ content,
+ indent: partial<Indent>(),
+ filename: 'package.json',
+ });
+ const res = await configMigration(config, branchList);
+ expect(res).toMatchObject({ result: 'no-migration' });
+ expect(checkConfigMigrationBranch).toHaveBeenCalledTimes(0);
+ expect(ensureConfigMigrationPr).toHaveBeenCalledTimes(0);
+ });
+
it('creates migration pr if needed', async () => {
const branchList: string[] = [];
mockedFunction(checkConfigMigrationBranch).mockResolvedValue({
diff --git a/lib/workers/repository/config-migration/index.ts b/lib/workers/repository/config-migration/index.ts
index 2574fdc4eac..fdd038f3274 100644
--- a/lib/workers/repository/config-migration/index.ts
+++ b/lib/workers/repository/config-migration/index.ts
@@ -27,6 +27,14 @@ export async function configMigration(
return { result: 'no-migration' };
}
+ if (migratedConfigData.filename === 'package.json') {
+ logger.debug(
+ ' Using package.json for Renovate config is deprecated - please use a dedicated configuration file instead. Skipping config migration.',
+ );
+ MigratedDataFactory.reset();
+ return { result: 'no-migration' };
+ }
+
const res = await checkConfigMigrationBranch(config, migratedConfigData);
// migration needed but not demanded by user