fix(landing): gh stars fetch with token

This commit is contained in:
Emir Karabeg
2025-03-23 13:27:56 -07:00
parent c38203b559
commit c5d537f12d
@@ -2,17 +2,20 @@ import { Star } from 'lucide-react'
import { GithubIcon } from '@/components/icons'
async function getGitHubStars() {
const token = process.env.GITHUB_TOKEN
const response = await fetch('https://api.github.com/repos/simstudioai/sim', {
headers: {
Accept: 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28',
...(token ? { Authorization: `Bearer ${token}` } : {}),
},
next: { revalidate: 3600 }, // Revalidate every hour
})
if (!response.ok) {
// Return 0 stars if API fails, we don't want to break the UI
return 0
// Return current stars if API fails, we don't want to break the UI
return 65
}
const data = await response.json()