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
+20 -6

No files matched your search

+15 -5
View File
@@ -52,15 +52,25 @@ await syncIssueLabels(userstylesData.userstyles);
/**
* Keep `.github/CODEOWNERS` in sync with the userstyle metadata.
*/
await updateFile(
join(REPO_ROOT, ".github/CODEOWNERS"),
Object.entries(userstylesData.userstyles)
.filter(([_, { "current-maintainers": currentMaintainers }]) => currentMaintainers.length > 0)
const CODEOWNERS_FILE = ".github/CODEOWNERS";
const maintainersCodeOwners = () => {
return Object.entries(userstylesData.userstyles)
.filter(([_, { "current-maintainers": currentMaintainers }]) =>
currentMaintainers.length > 0
)
.map(([slug, { "current-maintainers": currentMaintainers }]) => {
const codeOwners = currentMaintainers
.map((maintainer) => `@${maintainer.url.split("/").pop()}`)
.join(" ");
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()}`,
);