(
config: T & Partial<{pullRequest: PullRequestConfig}>,
)
| 70 | |
| 71 | /** Loads and validates the merge configuration. */ |
| 72 | export function assertValidPullRequestConfig<T extends NgDevConfig>( |
| 73 | config: T & Partial<{pullRequest: PullRequestConfig}>, |
| 74 | ): asserts config is T & {pullRequest: PullRequestConfig} { |
| 75 | const errors: string[] = []; |
| 76 | if (config.pullRequest === undefined) { |
| 77 | throw new ConfigValidationError( |
| 78 | 'No pullRequest configuration found. Set the `pullRequest` configuration.', |
| 79 | ); |
| 80 | } |
| 81 | |
| 82 | if (config.pullRequest.githubApiMerge === undefined) { |
| 83 | errors.push('No explicit choice of merge strategy. Please set `githubApiMerge`.'); |
| 84 | } |
| 85 | |
| 86 | if (errors.length) { |
| 87 | throw new ConfigValidationError('Invalid `pullRequest` configuration', errors); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | export interface PullRequestValidationConfig { |
| 92 | [key: `assert${string}`]: boolean; |
no test coverage detected