š Check Actively Maintained Repos
TODO
This file needs content for its H1 element. Perhaps to discuss the code a little more. If not at least add frontMatter.description so the <docCardList/> component has something to show.
import { execSync } from 'child_process';
import { readFileSync } from 'fs';
import { resolve } from 'path';
const __dirname = import.meta.dirname;
// 1. Fetch repos from GitHub CLI and filter to unarchived only (assumes the executor has visibility of all projects)
const ghOutput = execSync('gh repo list api3dao --limit 1000 --json name,isArchived', { encoding: 'utf8' });
const unarchivedGh = new Set(
JSON.parse(ghOutput)
.filter((r) => !r.isArchived)
.map((r) => r.name)
);
// 2. Parse the first column of every table row in the markdown
const md = readFileSync(resolve(__dirname, 'activelyMaintainedRepos.md'), 'utf8');
const mdRepos = new Set();
for (const match of md.matchAll(/^\|\s*\[([^\]]+)\]\(https:\/\/github\.com\/api3dao\/[^)]+\)/gm)) {
mdRepos.add(match[1]);
}
// 3. Compare
const missingFromMd = [...unarchivedGh].filter((r) => !mdRepos.has(r)).sort();
const extraInMd = [...mdRepos].filter((r) => !unarchivedGh.has(r)).sort();
console.log(`GitHub unarchived repos: ${unarchivedGh.size}`);
console.log(`Markdown repos: ${mdRepos.size}`);
if (missingFromMd.length === 0 && extraInMd.length === 0) {
console.log('\nā Lists match perfectly.');
} else {
if (missingFromMd.length > 0) {
console.log(`\nMissing from markdown (${missingFromMd.length}) ā unarchived on GitHub but not in the doc:`);
missingFromMd.forEach((r) => console.log(` - ${r}`));
}
if (extraInMd.length > 0) {
console.log(`\nExtra in markdown (${extraInMd.length}) ā in the doc but archived or deleted on GitHub:`);
extraInMd.forEach((r) => console.log(` - ${r}`));
}
process.exit(1);
}
Owner: UNKNOWN