ci(deno): refactor, bump dependencies, add lint job (#314)

This commit is contained in:
winston authored and GitHub committed 2023-11-14 23:37:48 +01:00
1 parent de543e687e
commit 50e9913601
13 files changed
+614 -808

No files matched your search

+24 -14
View File
@@ -1,5 +1,11 @@
#!/usr/bin/env -S deno run --allow-read --allow-net --allow-env
import { Ajv, assert, Octokit, parseYaml, path, schema } from "./deps.ts";
import * as assert from "std/assert/mod.ts";
import * as path from "std/path/mod.ts";
import { parse as parseYaml } from "std/yaml/mod.ts";
import Ajv from "ajv";
import { Octokit } from "octokit";
import { schema } from "./deps.ts";
import { Userstyle, UserstylesSchema } from "./types.d.ts";
const octokit = new Octokit({ auth: Deno.env.get("GITHUB_TOKEN") });
@@ -18,27 +24,31 @@ if (!validate(userstylesData)) {
console.error(validate.errors);
Deno.exit(1);
}
if (userstylesData.userstyles === undefined) {
Deno.exit(1);
}
// lowercase usernames of all the "current-maintainers" in the file
const maintainers = [
...new Set(
Object.values(userstylesData.userstyles).flatMap((style: Userstyle) =>
style.readme["current-maintainers"].map((m) => {
const username = m.url.split("github.com/")?.pop();
// check that they follow github.com/username pattern
assert.assertExists(username);
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
const teamMembers = await octokit.teams.listMembersInOrg({
...team,
per_page: 100,
}).then((res) => res.data.map((m) => m.login.toLowerCase()));
const teamMembers = await octokit.teams
.listMembersInOrg({
...team,
per_page: 100,
})
.then((res) => res.data.map((m) => m.login.toLowerCase()));
const syncMaintainers = async () => {
if (!maintainers) return;
@@ -65,4 +75,4 @@ const syncMaintainers = async () => {
}
};
await syncMaintainers();
await syncMaintainers();