Skip to content

Commit

Permalink
Update migration
Browse files Browse the repository at this point in the history
  • Loading branch information
illay1994 committed Oct 31, 2023
1 parent c2e8174 commit 8786ad6
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions lib/config/migrations/custom/fetch-release-notes-migration.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import is from '@sindresorhus/is';
import type { FetchChangeLogsOptions } from '../../types';
import { AbstractMigration } from '../base/abstract-migration';
import type { RenovateConfig } from '../../types';
import { RenamePropertyMigration } from '../base/rename-property-migration';

export class FetchReleaseNotesMigration extends AbstractMigration {
override deprecated = true;
override readonly propertyName = 'fetchReleaseNotes';

readonly newPropertyName = 'fetchChangeLogs';
export class FetchReleaseNotesMigration extends RenamePropertyMigration {
constructor(originalConfig: RenovateConfig, migratedConfig: RenovateConfig) {
super(
'fetchReleaseNotes',
'fetchChangeLogs',
originalConfig,
migratedConfig
);
}

override run(value: unknown): void {
let newValue: FetchChangeLogsOptions | undefined;
let newValue: unknown = value;

if (is.boolean(value)) {
newValue = value ? 'pr' : 'off';
} else if (value === 'off' || value === 'pr' || value === 'branch') {
newValue = value;
}

this.setSafely(this.newPropertyName, newValue);
super.run(newValue);
}
}

0 comments on commit 8786ad6

Please sign in to comment.