Skip to content

Commit c8411c5

Browse files
committed
feat: add labeled covered repo count stat
Signed-off-by: frank-zsy <[email protected]>
1 parent bb467ab commit c8411c5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/scripts/label_stats.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { getLabelData } from "../label_data_utils";
1+
import { query } from "../db/clickhouse";
2+
import { getLabelData, getPlatformData } from "../label_data_utils";
23

34
(async () => {
45
const labels = getLabelData();
@@ -16,4 +17,10 @@ import { getLabelData } from "../label_data_utils";
1617
}
1718
}
1819

20+
const labelPlatform = getPlatformData(['Region-0', 'Company', 'Community', 'Project', 'Foundation', 'Tech-0', 'Domain-0', 'Bot']);
21+
const repoCount = await query<number[]>(`SELECT COUNT(DISTINCT repo_id) FROM events WHERE ${labelPlatform.map(p =>
22+
`(((repo_id IN (${p.repos.map(r => r.id).join(',')})) OR (org_id IN (${p.orgs.map(r => r.id).join(',')}))) AND platform='${p.name}')`
23+
).join(' OR ')}`);
24+
console.table(`Repos covered by labels: ${repoCount[0][0]}`);
25+
1926
})();

0 commit comments

Comments
 (0)