Openstatus www.openstatus.dev
at 4c0f4c00a38753a5d0dfd7e7b7b7706dec6f1503 17 lines 416 B view raw
1import * as z from "zod"; 2 3const schema = z.object({ 4 stargazers_count: z.number(), 5}); 6 7export async function getGitHubStars() { 8 const res = await fetch( 9 "https://api.github.com/repos/openstatusHQ/openstatus", 10 { next: { revalidate: 600 } }, // 10min 11 ); 12 const json = await res.json(); 13 const github = schema.safeParse(json); 14 15 if (!github.success) return 0; 16 return github.data.stargazers_count; 17}