From 65adeaa282b75df7e3f8cc1776289f15f6fb0a6c Mon Sep 17 00:00:00 2001 From: Danny Wahl Date: Fri, 16 Feb 2024 06:49:32 -0700 Subject: [PATCH] authenticate github api calls for development rate limit 60 => 5000 --- isp-site/src/utils/explorer.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/isp-site/src/utils/explorer.js b/isp-site/src/utils/explorer.js index 5089a7c4..a58f5a20 100644 --- a/isp-site/src/utils/explorer.js +++ b/isp-site/src/utils/explorer.js @@ -6,7 +6,15 @@ async function getGithubRepoContents(owner, repo, branch) { const apiUrl = `${global.api}/repos/${owner}/${repo}/git/trees/${branch}?recursive=1`; try { - const response = await fetch(apiUrl); + const response = await fetch(apiUrl, { + method: "GET", + headers: { + Accept: "application/vnd.github.v3+json", + Authorization: process.env.REACT_APP_GITHUB_TOKEN + ? `token ${process.env.REACT_APP_GITHUB_TOKEN}` + : "", + }, + }); const data = await response.json(); return data.tree || null;