summaryrefslogtreecommitdiffhomepage
path: root/packages/console/app/src/lib/github.ts
diff options
context:
space:
mode:
authorDax <[email protected]>2025-10-01 19:38:15 -0400
committerGitHub <[email protected]>2025-10-01 19:38:15 -0400
commita782e3dac2c60429c2f06ccb1b20edaf5797ca0f (patch)
treebee5e0104d9e5721d8d48df899c45a292cfb6889 /packages/console/app/src/lib/github.ts
parent70da3a9399d3385b53f7831beb08f716b972860d (diff)
downloadopencode-a782e3dac2c60429c2f06ccb1b20edaf5797ca0f.tar.gz
opencode-a782e3dac2c60429c2f06ccb1b20edaf5797ca0f.zip
Zen lander (#2907)
Co-authored-by: David Hill <[email protected]> Co-authored-by: GitHub Action <[email protected]> Co-authored-by: Adam <[email protected]> Co-authored-by: Jay V <[email protected]>
Diffstat (limited to 'packages/console/app/src/lib/github.ts')
-rw-r--r--packages/console/app/src/lib/github.ts28
1 files changed, 28 insertions, 0 deletions
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")