Skip to content

Commit efc5843

Browse files
committed
Update GitHub API authorization in fetchData.js
1 parent 8d239dc commit efc5843

File tree

2 files changed

+227
-286
lines changed

2 files changed

+227
-286
lines changed

ReadmeSrc/scripts/fetchData.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ const delay = require('delay')
77
const data = require('../../webpage/src/data.json')
88

99
// https://github.com/settings/tokens
10-
const access_token = process.env.GITHUB_TOKEN
10+
const config = {
11+
headers: { Authorization: `token ${process.env.GITHUB_TOKEN}` }
12+
}
1113

1214
async function getPackagesData() {
1315
return Promise.all(data.rows.map(getPackageData))
@@ -48,13 +50,14 @@ const getNpmDownloads = npm =>
4850
const getIssueCount = (github, state) =>
4951
axios
5052
.get(
51-
`https://api.github.com/search/issues?access_token=${access_token}&q=repo:${github}+type:issue+state:${state}`
53+
`https://api.github.com/search/issues?q=repo:${github}+type:issue+state:${state}`,
54+
config
5255
)
5356
.then(response => response.data.total_count)
5457

5558
const getGithubRepoStats = github =>
5659
axios
57-
.get(`https://api.github.com/repos/${github}?access_token=${access_token}`)
60+
.get(`https://api.github.com/repos/${github}`, config)
5861
.then(response => response.data)
5962

6063
async function getGithubStats(github) {

0 commit comments

Comments
 (0)