Joey Perrott cc37af2314 fix(dev-infra): allow for deep merging of pullapprove config aliases (#36915)
Set the yaml parser to support deep merges of yaml aliases,
to support having a default value for all rules to build upon.

PR Close #36915
2020-06-15 14:29:32 -07:00

36 lines
807 B
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {parse as parseYaml} from 'yaml';
export interface PullApproveGroupConfig {
conditions?: string[];
reviewers?: {
users: string[],
teams?: string[],
}|{
teams: string[],
};
}
export interface PullApproveConfig {
version: number;
github_api_version?: string;
pullapprove_conditions?: {
condition: string,
unmet_status: string,
explanation: string,
}[];
groups: {
[key: string]: PullApproveGroupConfig,
};
}
export function parsePullApproveYaml(rawYaml: string): PullApproveConfig {
return parseYaml(rawYaml, {merge: true}) as PullApproveConfig;
}