feat(dev-infra): pullapprove verify should handle files
in conditions (#36661)
Currently, when verifying our pullapprove configuration, we don't respect modifications to the set of files in a condition. e.g. It's not possible to do the following: ``` contains_any_globs(files.exclude(...), [ ``` This prevents us from having codeowner groups which match a directory, but want to filter out specific sub directories. For example, `fw-core` matches all files in the core package. We want to exclude the schematics from that glob. Usually we do this by another exclude condition. This has a *significant* downside though. It means that fw-core will not be requested if a PR changes schematic code, _and_ actual fw-core code. To support these conditions, the pullapprove verification tool is refactored, so that it no longer uses Regular expressions for parsing, but rather evaluates the code through a dynamic function. This is possible since the conditions are written in simple Python that can be run in NodeJS too (with small modifications/transformations). PR Close #36661
This commit is contained in:

committed by
Andrew Kushnir

parent
25d4238371
commit
b97211ee2b
@ -10,8 +10,11 @@ import {verify} from './verify';
|
||||
|
||||
/** Build the parser for the pullapprove commands. */
|
||||
export function buildPullapproveParser(localYargs: yargs.Argv) {
|
||||
return localYargs.help().strict().demandCommand().command(
|
||||
'verify', 'Verify the pullapprove config', {}, () => verify());
|
||||
return localYargs.help()
|
||||
.strict()
|
||||
.option('verbose', {alias: ['v'], description: 'Enable verbose logging'})
|
||||
.demandCommand()
|
||||
.command('verify', 'Verify the pullapprove config', {}, ({verbose}) => verify(verbose));
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
|
Reference in New Issue
Block a user