renovate/lib/config/common.ts

234 lines
5.4 KiB
TypeScript
Raw Normal View History

import { LogLevel } from 'bunyan';
2020-05-01 16:03:48 +00:00
import { Range } from 'semver';
import { HostRule } from '../types';
2019-08-23 13:46:31 +00:00
export type RenovateConfigStage =
| 'global'
| 'repository'
| 'package'
| 'branch'
| 'pr';
export type RepositoryCacheConfig = 'disabled' | 'enabled' | 'reset';
export interface GroupConfig extends Record<string, unknown> {
branchName?: string;
branchTopic?: string;
}
2019-08-23 13:46:31 +00:00
// TODO: Proper typings
export interface RenovateSharedConfig {
$schema?: string;
2019-08-23 13:46:31 +00:00
automerge?: boolean;
branchPrefix?: string;
branchName?: string;
2020-05-03 08:14:22 +00:00
manager?: string;
commitMessage?: string;
commitMessagePrefix?: string;
draftPR?: boolean;
2019-08-23 13:46:31 +00:00
enabled?: boolean;
enabledManagers?: string[];
extends?: string[];
2020-05-03 08:14:22 +00:00
fileMatch?: string[];
group?: GroupConfig;
groupName?: string;
groupSlug?: string;
2020-05-03 08:14:22 +00:00
includePaths?: string[];
ignoreDeps?: string[];
ignorePaths?: string[];
labels?: string[];
addLabels?: string[];
2020-07-11 09:55:30 +00:00
dependencyDashboardApproval?: boolean;
hashedBranchLength?: number;
npmrc?: string;
platform?: string;
postUpgradeTasks?: PostUpgradeTasks;
prBodyColumns?: string[];
prBodyDefinitions?: Record<string, string>;
prCreation?: 'immediate' | 'not-pending' | 'status-success' | 'approval';
productLinks?: Record<string, string>;
prPriority?: number;
rebaseLabel?: string;
rebaseWhen?: string;
recreateClosed?: boolean;
repository?: string;
repositoryCache?: RepositoryCacheConfig;
requiredStatusChecks?: string[];
schedule?: string[];
semanticCommits?: 'auto' | 'enabled' | 'disabled';
semanticCommitScope?: string;
2019-08-23 13:46:31 +00:00
semanticCommitType?: string;
suppressNotifications?: string[];
timezone?: string;
unicodeEmoji?: boolean;
}
2021-02-05 08:20:47 +00:00
export interface RepoAdminConfig {
dockerImagePrefix?: string;
dockerUser?: string;
}
export interface RenovateAdminConfig {
allowPostUpgradeCommandTemplating?: boolean;
2020-02-04 05:59:13 +00:00
allowedPostUpgradeCommands?: string[];
autodiscover?: boolean;
autodiscoverFilter?: string;
baseDir?: string;
cacheDir?: string;
configWarningReuseIssue?: boolean;
customEnvVariables?: Record<string, string>;
dryRun?: boolean;
endpoint?: string;
localDir?: string;
logFile?: string;
logFileLevel?: LogLevel;
logLevel?: LogLevel;
logContext?: string;
onboarding?: boolean;
onboardingBranch?: string;
onboardingCommitMessage?: string;
onboardingPrTitle?: string;
onboardingConfig?: RenovateSharedConfig;
onboardingConfigFileName?: string;
platform?: string;
postUpdateOptions?: string[];
privateKey?: string | Buffer;
privateKeyPath?: string;
repositories?: RenovateRepository[];
requireConfig?: boolean;
trustLevel?: 'low' | 'high';
redisUrl?: string;
gitPrivateKey?: string;
2019-08-23 13:46:31 +00:00
}
2020-02-04 05:59:13 +00:00
export type PostUpgradeTasks = {
commands?: string[];
fileFilters?: string[];
};
2019-08-23 13:46:31 +00:00
type UpdateConfig<
T extends RenovateSharedConfig = RenovateSharedConfig
> = Partial<Record<UpdateType, T>>;
export type RenovateRepository =
| string
| {
repository: string;
};
2020-03-06 08:07:55 +00:00
export interface CustomManager {
fileMatch: string[];
2020-03-06 08:07:55 +00:00
matchStrings: string[];
matchStringsStrategy?: string;
2020-03-06 08:07:55 +00:00
depNameTemplate?: string;
datasourceTemplate?: string;
lookupNameTemplate?: string;
versioningTemplate?: string;
}
2019-08-23 13:46:31 +00:00
// TODO: Proper typings
export interface RenovateConfig
extends RenovateAdminConfig,
RenovateSharedConfig,
2019-08-23 13:46:31 +00:00
UpdateConfig<PackageRule>,
AssigneesAndReviewersConfig,
Record<string, unknown> {
depName?: string;
2019-08-23 13:46:31 +00:00
baseBranches?: string[];
baseBranch?: string;
defaultBranch?: string;
branchList?: string[];
2020-04-29 12:27:33 +00:00
description?: string | string[];
2019-08-23 13:46:31 +00:00
errors?: ValidationMessage[];
gitAuthor?: string;
hostRules?: HostRule[];
ignorePresets?: string[];
includeForks?: boolean;
isFork?: boolean;
fileList?: string[];
2020-07-11 09:55:30 +00:00
dependencyDashboard?: boolean;
dependencyDashboardAutoclose?: boolean;
dependencyDashboardChecks?: Record<string, string>;
dependencyDashboardRebaseAllOpen?: boolean;
dependencyDashboardTitle?: string;
dependencyDashboardHeader?: string;
dependencyDashboardFooter?: string;
packageFile?: string;
2019-08-23 13:46:31 +00:00
packageRules?: PackageRule[];
prConcurrentLimit?: number;
prHourlyLimit?: number;
registryUrls?: string[];
repoIsOnboarded?: boolean;
updateType?: UpdateType;
2019-08-23 13:46:31 +00:00
warnings?: ValidationMessage[];
vulnerabilityAlerts?: RenovateSharedConfig;
2020-03-06 08:07:55 +00:00
regexManagers?: CustomManager[];
fetchReleaseNotes?: boolean;
2019-08-23 13:46:31 +00:00
}
export interface AssigneesAndReviewersConfig {
assigneesFromCodeOwners?: boolean;
assignees?: string[];
assigneesSampleSize?: number;
reviewersFromCodeOwners?: boolean;
reviewers?: string[];
reviewersSampleSize?: number;
additionalReviewers?: string[];
}
2019-08-23 13:46:31 +00:00
export type UpdateType =
| 'major'
| 'minor'
| 'patch'
| 'pin'
| 'digest'
| 'lockFileMaintenance'
| 'lockfileUpdate'
2019-08-23 13:46:31 +00:00
| 'rollback'
| 'bump';
export type MatchStringsStrategy = 'any' | 'recursive' | 'combination';
2019-08-23 13:46:31 +00:00
// TODO: Proper typings
export interface PackageRule
extends RenovateSharedConfig,
UpdateConfig,
Record<string, any> {
matchPaths?: string[];
matchLanguages?: string[];
matchBaseBranches?: string[];
matchManagers?: string | string[];
matchDatasources?: string[];
matchDepTypes?: string[];
matchPackageNames?: string[];
matchPackagePatterns?: string[];
2019-08-23 13:46:31 +00:00
excludePackageNames?: string[];
excludePackagePatterns?: string[];
matchCurrentVersion?: string | Range;
matchSourceUrlPrefixes?: string[];
matchUpdateTypes?: UpdateType[];
2019-08-23 13:46:31 +00:00
}
export interface ValidationMessage {
depName: string;
message: string;
}