feat(dev-infra): handle excluding files via globs in pullapprove (#36162)
Updates the pullapprove verification script to handle cases of excluding globs from groups. PR Close #36162
This commit is contained in:

committed by
Alex Rickabaugh

parent
bfa7b1a494
commit
83e4a76afa
42
dev-infra/pullapprove/logging.ts
Normal file
42
dev-infra/pullapprove/logging.ts
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. 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 {PullApproveGroupResult} from './group';
|
||||
|
||||
/** Create logs for each pullapprove group result. */
|
||||
export function logGroup(group: PullApproveGroupResult, matched = true) {
|
||||
const includeConditions = matched ? group.matchedIncludes : group.unmatchedIncludes;
|
||||
const excludeConditions = matched ? group.matchedExcludes : group.unmatchedExcludes;
|
||||
console.groupCollapsed(`[${group.groupName}]`);
|
||||
if (includeConditions.length) {
|
||||
console.group('includes');
|
||||
includeConditions.forEach(
|
||||
matcher => console.info(`${matcher.glob} - ${matcher.matchedFiles.size}`));
|
||||
console.groupEnd();
|
||||
}
|
||||
if (excludeConditions.length) {
|
||||
console.group('excludes');
|
||||
excludeConditions.forEach(
|
||||
matcher => console.info(`${matcher.glob} - ${matcher.matchedFiles.size}`));
|
||||
console.groupEnd();
|
||||
}
|
||||
console.groupEnd();
|
||||
}
|
||||
|
||||
/** Logs a header within a text drawn box. */
|
||||
export function logHeader(...params: string[]) {
|
||||
const totalWidth = 80;
|
||||
const fillWidth = totalWidth - 2;
|
||||
const headerText = params.join(' ').substr(0, fillWidth);
|
||||
const leftSpace = Math.ceil((fillWidth - headerText.length) / 2);
|
||||
const rightSpace = fillWidth - leftSpace - headerText.length;
|
||||
const fill = (count: number, content: string) => content.repeat(count);
|
||||
|
||||
console.info(`┌${fill(fillWidth, '─')}┐`);
|
||||
console.info(`│${fill(leftSpace, ' ')}${headerText}${fill(rightSpace, ' ')}│`);
|
||||
console.info(`└${fill(fillWidth, '─')}┘`);
|
||||
}
|
Reference in New Issue
Block a user