build(CODEOWNERS): protect sensitive paths (#965)

This commit ensures that explicit approval
from catppuccin/userstyles-staff is required
for paths that are responsible for managing
the repository.
This commit is contained in:
Hammy authored and GitHub committed 2024-06-07 00:39:37 +01:00
1 parent 2bb7df4ce7
commit f97f2cf6bc
2 files changed
+19 -5

No files matched your search

+4
View File
@@ -81,3 +81,7 @@
/styles/wikiwand @Tnixc /styles/wikiwand @Tnixc
/styles/youtube @isabelroses @uncenter /styles/youtube @isabelroses @uncenter
/styles/nextjs @Dandraghas /styles/nextjs @Dandraghas
.github/CODEOWNERS @catppuccin/userstyles-staff
/scripts/ @catppuccin/userstyles-staff
/template/ @catppuccin/userstyles-staff
+15 -5
View File
@@ -52,15 +52,25 @@ await syncIssueLabels(userstylesData.userstyles);
/** /**
* Keep `.github/CODEOWNERS` in sync with the userstyle metadata. * Keep `.github/CODEOWNERS` in sync with the userstyle metadata.
*/ */
await updateFile( const CODEOWNERS_FILE = ".github/CODEOWNERS";
join(REPO_ROOT, ".github/CODEOWNERS"), const maintainersCodeOwners = () => {
Object.entries(userstylesData.userstyles) return Object.entries(userstylesData.userstyles)
.filter(([_, { "current-maintainers": currentMaintainers }]) => currentMaintainers.length > 0) .filter(([_, { "current-maintainers": currentMaintainers }]) =>
currentMaintainers.length > 0
)
.map(([slug, { "current-maintainers": currentMaintainers }]) => { .map(([slug, { "current-maintainers": currentMaintainers }]) => {
const codeOwners = currentMaintainers const codeOwners = currentMaintainers
.map((maintainer) => `@${maintainer.url.split("/").pop()}`) .map((maintainer) => `@${maintainer.url.split("/").pop()}`)
.join(" "); .join(" ");
return `/styles/${slug} ${codeOwners}`; return `/styles/${slug} ${codeOwners}`;
}) })
.join("\n"), .join("\n");
};
const userstylesStaffCodeOwners = () => {
const paths = [CODEOWNERS_FILE, "/scripts/", "/template/"];
return paths.map((path) => `${path} @catppuccin/userstyles-staff`).join("\n");
};
await updateFile(
join(REPO_ROOT, CODEOWNERS_FILE),
`${maintainersCodeOwners()}\n\n${userstylesStaffCodeOwners()}`,
); );