Skip to content

Commit

Permalink
Use access token for github api in Actions to avoid rate limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismaltby committed May 13, 2024
1 parent d9c75e3 commit e93542c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/scripts/fetchContributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
import Octokit from "@octokit/rest";
import { writeJSON } from "fs-extra";

if (!process.env.CREDITS_GITHUB_ACCESS_TOKEN) {
console.log("Env variable CREDITS_GITHUB_ACCESS_TOKEN is not set");
process.exit();
}

const ACCESS_TOKEN = process.env.CREDITS_GITHUB_ACCESS_TOKEN;

const octokit = new Octokit({});

const main = async () => {
Expand All @@ -13,6 +20,7 @@ const main = async () => {
per_page: 100,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
Authorization: `Bearer ${ACCESS_TOKEN}`,
},
}
);
Expand Down

0 comments on commit e93542c

Please sign in to comment.