From a782e3dac2c60429c2f06ccb1b20edaf5797ca0f Mon Sep 17 00:00:00 2001 From: Dax Date: Wed, 1 Oct 2025 19:38:15 -0400 Subject: Zen lander (#2907) Co-authored-by: David Hill Co-authored-by: GitHub Action Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com> Co-authored-by: Jay V --- packages/console/app/src/lib/github.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 packages/console/app/src/lib/github.ts (limited to 'packages/console/app/src/lib/github.ts') diff --git a/packages/console/app/src/lib/github.ts b/packages/console/app/src/lib/github.ts new file mode 100644 index 000000000..49b926463 --- /dev/null +++ b/packages/console/app/src/lib/github.ts @@ -0,0 +1,28 @@ +import { query } from "@solidjs/router" + +export const github = query(async () => { + "use server" + try { + const [meta, releases, contributors] = await Promise.all([ + fetch("https://api.github.com/repos/sst/opencode").then((res) => res.json()), + fetch("https://api.github.com/repos/sst/opencode/releases").then((res) => res.json()), + fetch("https://api.github.com/repos/sst/opencode/contributors?per_page=1"), + ]) + const [release] = releases + const contributorCount = Number.parseInt( + contributors.headers + .get("Link")! + .match(/&page=(\d+)>; rel="last"/)! + .at(1)!, + ) + return { + stars: meta.stargazers_count, + release: { + name: release.name, + url: release.html_url, + }, + contributors: contributorCount, + } + } catch {} + return undefined +}, "github") -- cgit v1.2.3