Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions server/loader/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ export async function githubApi<Response>(
): Promise<null | Response> {
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
Expand Down