You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/scripts/update-contributors.js
+12-17
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,14 @@ const data = JSON.parse(fs.readFileSync(CONTRIBUTORS_JSON, "utf8"));
7
7
8
8
constONE_WEEK=1000*60*60*24;
9
9
10
-
constGITHUB_TOKEN=process.env.GITHUB_TOKEN;
11
-
if(!GITHUB_TOKEN){
12
-
thrownewError(
13
-
'GITHUB_TOKEN not set! Create a token with "read:user" scope and set as an environment variable.\nhttps://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic',
14
-
);
10
+
functiongetGitHubToken(){
11
+
constGITHUB_TOKEN=process.env.GITHUB_TOKEN;
12
+
if(!GITHUB_TOKEN){
13
+
thrownewError(
14
+
'GITHUB_TOKEN not set! Create a token with "read:user" scope and set as an environment variable.\nhttps://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic',
15
+
);
16
+
}
17
+
returnGITHUB_TOKEN;
15
18
}
16
19
17
20
classUserFetchErrorextendsError{
@@ -37,7 +40,7 @@ async function fetchUserInfo(username) {
);// update file while fetching (sync happens safely in between fetches)
220
+
fs.writeFileSync(newURL("../data/contributors.json",import.meta.url),JSON.stringify(data));// update file while fetching (sync happens safely in between fetches)
226
221
}catch(err){
227
222
if(errinstanceofUserFetchError&&err.notFound){
228
223
console.warn(`[${i}/${total}] (Skipped ${username}, not found)`);
0 commit comments