Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): add applyMigrations function
- Loading branch information
1 parent
4925bb6
commit 01f7b2a
Showing
4 changed files
with
22 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { RenovateConfig } from '../types'; | ||
import type { Migration } from './migration'; | ||
import { RequiredStatusChecksMigration } from './required-status-checks-migration'; | ||
|
||
export function applyMigrations( | ||
originalConfig: RenovateConfig, | ||
migratedConfig: RenovateConfig | ||
): RenovateConfig { | ||
const migrations: Migration[] = [ | ||
new RequiredStatusChecksMigration(originalConfig, migratedConfig), | ||
]; | ||
|
||
for (const migration of migrations) { | ||
migration.migrate(); | ||
} | ||
|
||
return migratedConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import { RenovateConfig } from '../types'; | ||
import { Migration } from './migration'; | ||
|
||
export class RequiredStatusChecksMigration extends Migration { | ||
public migrate(): RenovateConfig { | ||
public migrate(): void { | ||
this.delete('requiredStatusChecks'); | ||
|
||
if (this.originalConfig.requiredStatusChecks === null) { | ||
this.migratedConfig.ignoreTests = true; | ||
} | ||
|
||
return this.migratedConfig; | ||
} | ||
} |