mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-15 17:16:25 +00:00
6f7b4afd1e
The existing npm-specific `unpublishSafe` setting will be removed and migrated instead to use `stabilityDays` (3). The `renovate/unpublish-safe` status check is also deprecated and the existing `renovate/stability-days` will be used instead. Closes #5265 BREAKING CHANGE: The status check `renovate/unpublish-safe` will be replaced with `renovate/stability-days`. Please migrate any branch protection rules if you were relying on `renovate/unpublish-safe`.
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { RenovateConfig } from '../../config';
|
|
import { logger } from '../../logger';
|
|
import { platform } from '../../platform';
|
|
import { BranchStatus } from '../../types';
|
|
|
|
async function setStatusCheck(
|
|
branchName: string,
|
|
context: string,
|
|
description: string,
|
|
state: BranchStatus,
|
|
url: string
|
|
): Promise<void> {
|
|
const existingState = await platform.getBranchStatusCheck(
|
|
branchName,
|
|
context
|
|
);
|
|
if (existingState === state) {
|
|
logger.debug(`Status check ${context} is already up-to-date`);
|
|
} else {
|
|
logger.debug(`Updating ${context} status check state to ${state}`);
|
|
await platform.setBranchStatus({
|
|
branchName,
|
|
context,
|
|
description,
|
|
state,
|
|
url,
|
|
});
|
|
}
|
|
}
|
|
|
|
export type StabilityConfig = RenovateConfig & {
|
|
stabilityStatus?: BranchStatus;
|
|
branchName: string;
|
|
};
|
|
|
|
export async function setStability(config: StabilityConfig): Promise<void> {
|
|
if (!config.stabilityStatus) {
|
|
return;
|
|
}
|
|
const context = `renovate/stability-days`;
|
|
const description =
|
|
config.stabilityStatus === BranchStatus.green
|
|
? 'Updates have met stability days requirement'
|
|
: 'Updates have not met stability days requirement';
|
|
await setStatusCheck(
|
|
config.branchName,
|
|
context,
|
|
description,
|
|
config.stabilityStatus,
|
|
config.productLinks.documentation
|
|
);
|
|
}
|