Skip to content

Commit

Permalink
build(CODEOWNERS): protect sensitive paths (#965)
Browse files Browse the repository at this point in the history
This commit ensures that explicit approval
from catppuccin/userstyles-staff is required
for paths that are responsible for managing
the repository.
  • Loading branch information
sgoudham authored Jun 6, 2024
1 parent 2bb7df4 commit f97f2cf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,8 @@
/styles/wikipedia @GitMuslim
/styles/wikiwand @Tnixc
/styles/youtube @isabelroses @uncenter
/styles/nextjs @Dandraghas
/styles/nextjs @Dandraghas

.github/CODEOWNERS @catppuccin/userstyles-staff
/scripts/ @catppuccin/userstyles-staff
/template/ @catppuccin/userstyles-staff
20 changes: 15 additions & 5 deletions scripts/generate/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`,
);

0 comments on commit f97f2cf

Please sign in to comment.