diff --git a/aio/scripts/verify-docs-codeownership.js b/aio/scripts/verify-docs-codeownership.js index 4b36b3b136db6..7947165252791 100644 --- a/aio/scripts/verify-docs-codeownership.js +++ b/aio/scripts/verify-docs-codeownership.js @@ -71,6 +71,11 @@ function getPathsFromCodeowners() { // different kinds of matches (guide, image, example) later (see `isImage`/`isExample` below). const aioGuidesOrImagesPathRe = /^\/aio\/content\/(?:(images\/)?guide|(examples))\/([^\s\*/]+)/; const pkgExamplesPathRe = /^\/packages\/examples\/([^\s\*/]+)/; + const manualGlobExpansions = { + // `CODEOWNERS` has a glob to match all `testing/` directories, so no specific glob for + // `packages/examples/testing/` is necessary. + 'testing/**': ['/packages/examples/testing/**'], + }; const aioGuides = []; const aioImages = []; @@ -83,6 +88,14 @@ function getPathsFromCodeowners() { split('\n'). map(l => l.trim()); + // Manually expand globs to known matching patterns. + for (const [glob, expansions] of Object.entries(manualGlobExpansions)) { + const matchingLine = lines.find(l => l.startsWith(`${glob} `)); + if (matchingLine !== undefined) { + lines.push(...expansions); + } + } + // Collect `aio/` guides/images/examples. lines. map(l => l.match(aioGuidesOrImagesPathRe)).