Commit fed3a62 1 parent 609d3c3 commit fed3a62 Copy full SHA for fed3a62
File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1
1
// Fetch package extra data
2
2
3
3
const axios = require ( "axios" ) ;
4
+ const config = require ( "config" ) ;
4
5
const urljoin = require ( "url-join" ) ;
5
6
const packageExtra = require ( "../models/packageExtra" ) ;
6
7
const {
@@ -41,11 +42,12 @@ const fetchExtraData = async function(packageNames) {
41
42
}
42
43
// Fetch stars
43
44
try {
45
+ const headers = { Accept : "application/vnd.github.v3.json" } ;
46
+ if ( config . gitHub . token )
47
+ headers . authorization = `Bearer ${ config . gitHub . token } ` ;
44
48
const resp = await axios . get (
45
49
urljoin ( "https://api.github.com/repos/" , pkg . repo ) ,
46
- {
47
- headers : { Accept : "application/vnd.github.v3.json" }
48
- }
50
+ { headers }
49
51
) ;
50
52
const repoInfo = resp . data ;
51
53
let stars = 0 ;
You can’t perform that action at this time.
0 commit comments