mirror of
https://github.com/System-End/site.git
synced 2026-04-20 00:25:19 +00:00
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
import { graphql } from '@octokit/graphql'
|
|
|
|
export async function fetchStars() {
|
|
if (!process.env.GITHUB_TOKEN) {
|
|
console.warn(
|
|
'Note - GITHUB_TOKEN not defined, stars will not be fetched from github'
|
|
)
|
|
return {
|
|
sprig: '?',
|
|
sinerider: '?',
|
|
sprigHardware: '?',
|
|
hackclub: '?',
|
|
hackathons: '?',
|
|
blot: '?',
|
|
onboard: '?'
|
|
}
|
|
}
|
|
const { organization } = await graphql(
|
|
`
|
|
{
|
|
organization(login: "hackclub") {
|
|
blot: repository(name: "blot") {
|
|
stargazerCount
|
|
}
|
|
sinerider: repository(name: "sinerider") {
|
|
stargazerCount
|
|
}
|
|
sprig: repository(name: "sprig") {
|
|
stargazerCount
|
|
}
|
|
hackclub: repository(name: "hackclub") {
|
|
stargazerCount
|
|
}
|
|
hackathons: repository(name: "hackathons") {
|
|
stargazerCount
|
|
}
|
|
sprigHardware: repository(name: "sprig-hardware") {
|
|
stargazerCount
|
|
}
|
|
onboard: repository(name: "onboard") {
|
|
stargazerCount
|
|
}
|
|
}
|
|
}
|
|
`,
|
|
{
|
|
headers: {
|
|
authorization: `token ${process.env.GITHUB_TOKEN}`
|
|
}
|
|
}
|
|
)
|
|
return organization
|
|
}
|
|
|
|
export default async function Stars(req, res) {
|
|
res.status(200).json(await fetchStars())
|
|
}
|