From a75252f183177af8617be3c4deaee931fa4d8047 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Sun, 3 Nov 2024 15:59:33 +0530 Subject: [PATCH 1/2] chore: use authenticated GitHub API locally if token is present --- src/utilities/githubAPI.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utilities/githubAPI.mjs b/src/utilities/githubAPI.mjs index d6b7b70ddd41..9055c26ae433 100644 --- a/src/utilities/githubAPI.mjs +++ b/src/utilities/githubAPI.mjs @@ -20,7 +20,9 @@ if ( }); console.log('api is authenticated on vercel'); } else { - api = new GithubAPI(); - console.log('api is not authenticated'); + api = new GithubAPI({ + auth: process.env.GITHUB_TOKEN, + }); + console.log(typeof process.env.GITHUB_TOKEN === "undefined" ? 'api is not authenticated' : 'api is authenticated locally'); } export default api; From 25173c3ea55f182a8cb9998443d41f4df142f993 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Sun, 3 Nov 2024 16:02:03 +0530 Subject: [PATCH 2/2] chore: fix lint --- src/utilities/githubAPI.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utilities/githubAPI.mjs b/src/utilities/githubAPI.mjs index 9055c26ae433..ded4f1f96b1a 100644 --- a/src/utilities/githubAPI.mjs +++ b/src/utilities/githubAPI.mjs @@ -23,6 +23,10 @@ if ( api = new GithubAPI({ auth: process.env.GITHUB_TOKEN, }); - console.log(typeof process.env.GITHUB_TOKEN === "undefined" ? 'api is not authenticated' : 'api is authenticated locally'); + console.log( + typeof process.env.GITHUB_TOKEN === 'undefined' + ? 'api is not authenticated' + : 'api is authenticated locally' + ); } export default api;