From ac31ad94bd957573ec89cda83fb16d1e5c1b17c8 Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Fri, 23 Sep 2022 15:12:25 +0000 Subject: [PATCH 1/3] doc: fix command --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 278fb54..c60d7ae 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ You have to create a token with the `read:org` access. The following command allows you to get information on your organization. The generated files may be found in the `data` folder. ``` -yarn start +yarn start generate ``` The following command allows you to get insights from your organization's information. From 34e8f802b346927714ffa1ee33a8ffbc673e0b6e Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Fri, 23 Sep 2022 15:20:49 +0000 Subject: [PATCH 2/3] fix: no token on contributors list (wip) --- src/queries.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/queries.js b/src/queries.js index 87894a3..276ee50 100644 --- a/src/queries.js +++ b/src/queries.js @@ -27,7 +27,8 @@ async function getRateLimit() { async function getRepositoryContributors(owner, repository) { try { const res = await fetch( - `https://api.github.com/repos/${owner}/${repository}/stats/contributors?access_token=${githubToken}`, + `https://api.github.com/repos/${owner}/${repository}/stats/contributors + `, { headers: { 'User-Agent': githubId } }, ) if (!res.ok) { @@ -36,7 +37,7 @@ async function getRepositoryContributors(owner, repository) { if (res.status === 204) { return [] } - return res.json() + return [res.json()] } catch (e) { console.log(e) process.exit(0) From a46cab0aa99939a3d2a647c971cdc24b2f167f36 Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Fri, 23 Sep 2022 15:21:13 +0000 Subject: [PATCH 3/3] fix: slow down request to avoid getting rate limit --- src/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.js b/src/core.js index a5c82ce..7916c65 100644 --- a/src/core.js +++ b/src/core.js @@ -28,7 +28,7 @@ async function* generateOrganizationData(githubOrganization) { const repositories = await getRepositoriesByUser(member.login) for (repository of repositories) { - await sleep(25) + await sleep(1000) const contributors = await getRepositoryContributors( repository.owner.login, repository.name,