Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/10641-pgp
# Conflicts: # yarn.lock
- Loading branch information
Showing
57 changed files
with
1,480 additions
and
1,467 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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { RenovateConfig } from '../types'; | ||
|
||
export abstract class Migration { | ||
protected readonly originalConfig: RenovateConfig; | ||
|
||
protected readonly migratedConfig: RenovateConfig; | ||
|
||
constructor(originalConfig: RenovateConfig, migratedConfig: RenovateConfig) { | ||
this.originalConfig = originalConfig; | ||
this.migratedConfig = migratedConfig; | ||
} | ||
|
||
abstract migrate(): void; | ||
|
||
protected delete(property: string): void { | ||
delete this.migratedConfig[property]; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
lib/config/migrations/required-status-checks-migration.spec.ts
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,21 @@ | ||
import { RequiredStatusChecksMigration } from './required-status-checks-migration'; | ||
|
||
describe('config/migrations/required-status-checks-migration', () => { | ||
it('should migrate requiredStatusChecks=null to ignoreTests=true', () => { | ||
const originalConfig: any = { | ||
requiredStatusChecks: null, | ||
}; | ||
const migratedConfig: any = { | ||
requiredStatusChecks: null, | ||
}; | ||
const migration = new RequiredStatusChecksMigration( | ||
originalConfig, | ||
migratedConfig | ||
); | ||
|
||
expect(migratedConfig.requiredStatusChecks).toBeNull(); | ||
migration.migrate(); | ||
expect(migratedConfig.requiredStatusChecks).toBeUndefined(); | ||
expect(migratedConfig.ignoreTests).toBeTrue(); | ||
}); | ||
}); |
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,11 @@ | ||
import { Migration } from './migration'; | ||
|
||
export class RequiredStatusChecksMigration extends Migration { | ||
public migrate(): void { | ||
this.delete('requiredStatusChecks'); | ||
|
||
if (this.originalConfig.requiredStatusChecks === null) { | ||
this.migratedConfig.ignoreTests = true; | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.