mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-26 17:48:30 -04:00
don't fail the entire build if GH_PUBLIC_TOKEN
isn't set
This commit is contained in:
parent
a2f9b21886
commit
25b2e7133b
@ -71,6 +71,17 @@ const Projects = ({ repos }: { repos: Repository[] }) => {
|
||||
};
|
||||
|
||||
export const getStaticProps: GetStaticProps = async () => {
|
||||
// don't fail the entire site build if the required API key for this page is missing
|
||||
if (typeof process.env.GH_PUBLIC_TOKEN === "undefined" || process.env.GH_PUBLIC_TOKEN === "") {
|
||||
console.warn(`ERROR: I can't fetch any GitHub projects without "GH_PUBLIC_TOKEN" set! Skipping for now...`);
|
||||
|
||||
return {
|
||||
props: {
|
||||
repos: [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// https://docs.github.com/en/graphql/reference/objects#repository
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const response: any = await graphql(
|
||||
|
Loading…
x
Reference in New Issue
Block a user