From f6fa60e6b4ed2aaf253da433edd81a028d93b6f8 Mon Sep 17 00:00:00 2001 From: MikhailB <36865467+lKolabrodl@users.noreply.github.com> Date: Wed, 2 Sep 2026 19:08:59 +0300 Subject: [PATCH] Add namespaced GitHub token --- README.md | 2 +- server/loader/github.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dae2397..dd0ddde 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Start web UI to review changes: npx multiocular ``` -If you have GitHub API limit, define `GITHUB_TOKEN` environment variable with [personal token](https://github.com/settings/personal-access-tokens/new) with access to public repositories. +If you have GitHub API limit, define `MULTIOCULAR_GITHUB_TOKEN` or `GITHUB_TOKEN` environment variable with [personal token](https://github.com/settings/personal-access-tokens/new) with access to public repositories. `MULTIOCULAR_GITHUB_TOKEN` takes priority when both variables are defined. ## Motivation diff --git a/server/loader/github.ts b/server/loader/github.ts index da7051f..be3608c 100644 --- a/server/loader/github.ts +++ b/server/loader/github.ts @@ -31,8 +31,9 @@ export async function githubApi( ): Promise { let name = isRepositoryUrl(repo) ? parseRepoFromUrl(repo) : repo let headers: HeadersInit = {} - if (process.env.GITHUB_TOKEN) { - headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}` + let token = process.env.MULTIOCULAR_GITHUB_TOKEN || process.env.GITHUB_TOKEN + if (token) { + headers.Authorization = `Bearer ${token}` } let response = await fetch(`https://api.github.com/repos/${name}${path}`, { headers