diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a1948c8cab8a28..b663700ffa1298 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -10,7 +10,6 @@ /.github/actions/assign-pr/index.js @cloudflare/pcx-technical-writing /.github/styles/cloudflare/spelling-exceptions.txt @cloudflare/pcx-technical-writing /src/components/ @cloudflare/developer-advocacy @kristianfreeman @kodster28 @pedrosousa @marciocloudflare @haleycode @maxvp @GregBrimble @KianNH @WalshyDev -/functions/ @cloudflare/developer-advocacy @kristianfreeman @kodster28 @pedrosousa @haleycode @marciocloudflare @maxvp @GregBrimble @KianNH @WalshyDev *.js @cloudflare/developer-advocacy @kristianfreeman @kodster28 @pedrosousa @haleycode @maxvp @marciocloudflare @GregBrimble @KianNH @WalshyDev *.ts @cloudflare/developer-advocacy @kristianfreeman @kodster28 @pedrosousa @haleycode @maxvp @marciocloudflare @GregBrimble @KianNH @WalshyDev /src/content/workers-ai-models/ @craigsdennis @pedrosousa @cloudflare/pcx-technical-writing @@ -20,7 +19,6 @@ /src/content/docs/ai-gateway/ @kathayl @G4brym @mchenco @daisyfaithauma @cloudflare/pcx-technical-writing /src/content/docs/workers-ai/ @rita3ko @craigsdennis @markdembo @mchenco @daisyfaithauma @cloudflare/pcx-technical-writing -/src/content/docs/workers-ai/static @mchenco @craigsdennis @cloudflare/pcx-technical-writing /src/content/docs/vectorize/ @elithrar @vy-ton @sejoker @mchenco @cloudflare/pcx-technical-writing /src/content/partials/vectorize/ @elithrar @mchenco @sejoker @cloudflare/pcx-technical-writing /src/content/changelogs/workers-ai.yaml @kathayl @G4brym @mchenco @daisyfaithauma @cloudflare/pcx-technical-writing @@ -56,7 +54,7 @@ /src/content/docs/cloudflare-one/policies/access/ @kennyj42 @ranbel @cloudflare/pcx-technical-writing /src/content/docs/cloudflare-one/connections/connect-devices/ @kkrum @kokolocomotion1 @ranbel @cloudflare/pcx-technical-writing /src/content/docs/cloudflare-one/connections/connect-networks/ @ranbel @cloudflare/pcx-technical-writing -/src/content/docs/cloudflare-one/applications/scan-apps/ @maxvp @cloudflare/pcx-technical-writing +/src/content/docs/cloudflare-one/applications/casb/ @maxvp @cloudflare/pcx-technical-writing /src/content/docs/cloudflare-one/policies/gateway/ @maxvp @cloudflare/pcx-technical-writing /src/content/docs/cloudflare-one/policies/browser-isolation/ @maxvp @ranbel @cloudflare/pcx-technical-writing /src/content/docs/cloudflare-one/policies/data-loss-prevention/ @maxvp @cloudflare/pcx-technical-writing @@ -78,7 +76,6 @@ /src/content/docs/cloudflare-for-platforms/cloudflare-for-saas/ @RebeccaTamachiro @cloudflare/pcx-technical-writing /src/content/docs/dns/ @RebeccaTamachiro @cloudflare/pcx-technical-writing /src/content/docs/fundamentals/ @dcpena @cloudflare/pcx-technical-writing -/src/content/docs/fundamentals/account-and-billing/ @dcpena @cloudflare/pcx-technical-writing /src/content/docs/learning-paths/ @cloudflare/pcx-technical-writing /src/content/docs/network-error-logging/ @dcpena @cloudflare/pcx-technical-writing /src/content/docs/network-interconnect/ @marciocloudflare @cloudflare/pcx-technical-writing @@ -126,17 +123,17 @@ /src/content/docs/workers/runtime-apis/ @irvinebroque @jasnell @mikenomitch @GregBrimble @ToriLindsay @cloudflare/pcx-technical-writing /src/content/docs/workers/runtime-apis/bindings/ @irvinebroque @mikenomitch @GregBrimble @ToriLindsay @cloudflare/pcx-technical-writing /src/content/docs/workers/platform/ @irvinebroque @GregBrimble @cloudflare/deploy-config @cloudflare/pcx-technical-writing -/src/content/docs/workers/configuration/compatibility-dates/ @irvinebroque @mikenomitch @GregBrimble @ToriLindsay @cloudflare/deploy-config @cloudflare/pcx-technical-writing -/src/content/docs/workers/configuration/compatibility-flags/ @irvinebroque @mikenomitch @GregBrimble @ToriLindsay @cloudflare/deploy-config @cloudflare/pcx-technical-writing +/src/content/docs/workers/configuration/compatibility-dates.mdx @irvinebroque @mikenomitch @GregBrimble @ToriLindsay @cloudflare/deploy-config @cloudflare/pcx-technical-writing +/src/content/docs/workers/configuration/compatibility-flags.mdx @irvinebroque @mikenomitch @GregBrimble @ToriLindsay @cloudflare/deploy-config @cloudflare/pcx-technical-writing -/src/content/docs/workers/reference/migrate-to-module-workers/ @irvinebroque @GregBrimble @ToriLindsay @cloudflare/deploy-config @cloudflare/pcx-technical-writing -/src/content/docs/workers/reference/security-model/ @irvinebroque @GregBrimble @ToriLindsay @cloudflare/pcx-technical-writing +/src/content/docs/workers/reference/migrate-to-module-workers.mdx @irvinebroque @GregBrimble @ToriLindsay @cloudflare/deploy-config @cloudflare/pcx-technical-writing +/src/content/docs/workers/reference/security-model.mdx @irvinebroque @GregBrimble @ToriLindsay @cloudflare/pcx-technical-writing /src/content/compatibility-flags/ @irvinebroque @mikenomitch @GregBrimble @cloudflare/pcx-technical-writing /src/content/docs/workers/wrangler/ @cloudflare/wrangler @cloudflare/wrangler-friends @irvinebroque @ToriLindsay @cloudflare/pcx-technical-writing /src/content/docs/workers/frameworks/ @igorminar @dario-piotrowicz @jculvey @aninibread @GregBrimble @ToriLindsay @cloudflare/pcx-technical-writing /src/content/docs/pages/framework-guides/ @igorminar @dario-piotrowicz @jculvey @aninibread @GregBrimble @ToriLindsay @cloudflare/pcx-technical-writing /src/content/docs/analytics/analytics-engine/ @irvinebroque @elithrar @cloudflare/pcx-technical-writing -/cloudflare-for-platforms/workers-for-platforms/ @irvinebroque @angelampcosta @GregBrimble @cloudflare/deploy-config @cloudflare/pcx-technical-writing +/src/content/docs/cloudflare-for-platforms/workers-for-platforms/ @irvinebroque @angelampcosta @GregBrimble @cloudflare/deploy-config @cloudflare/pcx-technical-writing /src/content/docs/workers/observability/ @irvinebroque @mikenomitch @rohinlohe @ToriLindsay @cloudflare/pcx-technical-writing /src/content/docs/workers/static-assets @irvinebroque @GregBrimble @WalshyDev @ToriLindsay @cloudflare/deploy-config @cloudflare/pcx-technical-writing /src/content/docs/workflows/ @ToriLindsay @elithrar @celso @sidharthachatterjee @cloudflare/pcx-technical-writing diff --git a/bin/validate-codeowners.ts b/bin/validate-codeowners.ts new file mode 100644 index 00000000000000..0f44993afe5ea3 --- /dev/null +++ b/bin/validate-codeowners.ts @@ -0,0 +1,34 @@ +import { spawnSync } from "node:child_process"; +import { loadOwners, matchPattern } from "codeowners-utils"; + +let owners = await loadOwners(process.cwd()); + +if (!owners) { + throw new Error("Unable to load CODEOWNERS file."); +} + +const result = spawnSync("git", ["ls-files"], { encoding: "utf-8" }); +const files = result.stdout.trim().split("\n"); + +owners = owners.filter((entry) => entry.pattern !== "*"); + +const unmatchedPatterns = owners + .filter((entry) => { + for (const file of files) { + const match = matchPattern(file, entry.pattern); + + if (match) { + return false; + } + } + + return true; + }) + .map((entry) => entry.pattern); + +if (unmatchedPatterns.length > 0) { + console.error( + `CODEOWNERS contains ${unmatchedPatterns.length} patterns that do not match any files in the repository:`, + ); + console.error(unmatchedPatterns); +} diff --git a/package-lock.json b/package-lock.json index a6cad29507ef35..a637c627d7e407 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,7 @@ "astro-breadcrumbs": "3.3.1", "astro-icon": "1.1.5", "astro-live-code": "0.0.5", + "codeowners-utils": "1.0.2", "date-fns": "4.1.0", "dedent": "1.5.3", "dompurify": "3.2.3", @@ -8505,6 +8506,75 @@ "node": ">=6" } }, + "node_modules/codeowners-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/codeowners-utils/-/codeowners-utils-1.0.2.tgz", + "integrity": "sha512-4oLRCymV7azxGHMpM3F297D651VdwZa21hVfFCn/cOd8Fq8tFrpfpyRpSBQkaZCyFPkfOhEld9xceCF7btyiug==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.2", + "find-up": "^4.1.0", + "ignore": "^5.1.4", + "locate-path": "^5.0.0" + } + }, + "node_modules/codeowners-utils/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/codeowners-utils/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/codeowners-utils/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/codeowners-utils/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/collapse-white-space": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.1.0.tgz", diff --git a/package.json b/package.json index 391b328fe13dde..9c2942db31178e 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "astro-breadcrumbs": "3.3.1", "astro-icon": "1.1.5", "astro-live-code": "0.0.5", + "codeowners-utils": "1.0.2", "date-fns": "4.1.0", "dedent": "1.5.3", "dompurify": "3.2.3",