MCPcopy Create free account
hub / github.com/angular/dev-infra / assertValidPullRequestConfig

Function assertValidPullRequestConfig

ng-dev/pr/config/index.ts:72–89  ·  view source on GitHub ↗
(
  config: T & Partial<{pullRequest: PullRequestConfig}>,
)

Source from the content-addressed store, hash-verified

70
71/** Loads and validates the merge configuration. */
72export 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
91export interface PullRequestValidationConfig {
92 [key: `assert${string}`]: boolean;

Callers 4

checkValidityFunction · 0.90
printTargetBranchesForPrFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected