From 568c7a18dd0dfcd27eafe7c290985b0c83844684 Mon Sep 17 00:00:00 2001 From: Liam Randall Date: Fri, 2 Oct 2026 18:42:41 -0400 Subject: [PATCH] fix(github-stars): authenticate preload and don't fail the build on error The plugin called the GitHub API anonymously, sharing a 60/hour limit per IP with every other build on the Netlify machine. Rate-limit 403s failed the production build for af7225cb, so the 2026-09-30 meeting pages never deployed. Pass GITHUB_TOKEN to Octokit, and treat a failed preload as a warning: the client already fetches star counts at runtime when nothing was preloaded. Co-Authored-By: Claude Signed-off-by: Liam Randall --- packages/docusaurus-github-stars/src/index.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/docusaurus-github-stars/src/index.ts b/packages/docusaurus-github-stars/src/index.ts index f145df510..d48310cd8 100644 --- a/packages/docusaurus-github-stars/src/index.ts +++ b/packages/docusaurus-github-stars/src/index.ts @@ -19,12 +19,18 @@ export default async function githubStars( return; } const [owner, repo] = options.preloadRepo.split('/'); - const octokit = new Octokit(); - const response = await octokit.repos.get({ owner, repo }); - if (response.status !== 200) { - logger.report('throw')(`Failed to fetch repo data for ${options.preloadRepo}`); + // Authenticate when a token is available: anonymous requests share a + // 60/hour limit per IP, which CI and Netlify build machines exhaust. + const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN }); + try { + const response = await octokit.repos.get({ owner, repo }); + return response.data; + } catch (err) { + // Star counts are cosmetic: the client fetches them at runtime when + // nothing was preloaded, so a GitHub failure shouldn't fail the build. + logger.warn(`Failed to preload repo data for ${options.preloadRepo}: ${err}`); + return undefined; } - return response.data; }, injectHtmlTags: ({ content }) => { if (!content) return {};