ci: sync only the current-maintainers (#275)
This commit ensures that the syncMaintainers GitHub action does not send team invites to all collaborators but only the current maintainers.
This commit is contained in:
1 parent
230e14f2ae
commit
a269d81342
1 file changed
+15
-8
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env -S deno run --allow-read --allow-net --allow-env
|
#!/usr/bin/env -S deno run --allow-read --allow-net --allow-env
|
||||||
import { Ajv, assert, Octokit, parseYaml, path, schema } from "./deps.ts";
|
import { Ajv, assert, Octokit, parseYaml, path, schema } from "./deps.ts";
|
||||||
import { UserstylesSchema } from "./types.d.ts";
|
import { Userstyle, UserstylesSchema } from "./types.d.ts";
|
||||||
|
|
||||||
const octokit = new Octokit({ auth: Deno.env.get("GITHUB_TOKEN") });
|
const octokit = new Octokit({ auth: Deno.env.get("GITHUB_TOKEN") });
|
||||||
const team = { org: "catppuccin", team_slug: "userstyles-maintainers" };
|
const team = { org: "catppuccin", team_slug: "userstyles-maintainers" };
|
||||||
@@ -19,13 +19,20 @@ if (!validate(userstylesData)) {
|
|||||||
Deno.exit(1);
|
Deno.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// lowercase usernames of all maintainers in the file
|
// lowercase usernames of all the "current-maintainers" in the file
|
||||||
const maintainers = userstylesData.collaborators?.map((c) => {
|
const maintainers = [
|
||||||
const username = c.url.split("github.com/")?.pop();
|
...new Set(
|
||||||
// check that they follow github.com/username pattern
|
Object.values(userstylesData.userstyles).flatMap((style: Userstyle) =>
|
||||||
assert.assertExists(username);
|
style.readme["current-maintainers"].map((m) => {
|
||||||
return username.toLowerCase();
|
const username = m.url.split("github.com/")?.pop();
|
||||||
});
|
// check that they follow github.com/username pattern
|
||||||
|
assert.assertExists(username);
|
||||||
|
return username.toLowerCase();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
// lowercase usernames of all maintainers in the current GH team
|
// lowercase usernames of all maintainers in the current GH team
|
||||||
const teamMembers = await octokit.teams.listMembersInOrg({
|
const teamMembers = await octokit.teams.listMembersInOrg({
|
||||||
|
|||||||
Reference in new issue
Block a user