File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,15 @@ var pAll = require('p-all')
9
9
10
10
require ( 'dotenv' ) . config ( )
11
11
12
+ var ghToken = process . env . GH_TOKEN
13
+ var npmToken = process . env . NPM_TOKEN
14
+
15
+ if ( ! ghToken || ! npmToken ) {
16
+ console . log ( 'Cannot crawl ecosystem without GH or npm tokens' )
17
+ /* eslint-disable-next-line unicorn/no-process-exit */
18
+ process . exit ( )
19
+ }
20
+
12
21
var topics = require ( '../generate/util/constant-topic' )
13
22
var orgs = require ( '../generate/util/constant-collective' )
14
23
@@ -47,8 +56,8 @@ var main = promisify(
47
56
)
48
57
49
58
main ( {
50
- ghToken : process . env . GH_TOKEN ,
51
- npmToken : process . env . NPM_TOKEN ,
59
+ ghToken,
60
+ npmToken,
52
61
repos : [ ] ,
53
62
topics : topics ,
54
63
orgs : orgs
Original file line number Diff line number Diff line change @@ -4,6 +4,14 @@ var fetch = require('node-fetch')
4
4
5
5
require ( 'dotenv' ) . config ( )
6
6
7
+ var token = process . env . OC_TOKEN
8
+
9
+ if ( ! token ) {
10
+ console . log ( 'Cannot crawl sponsors without OC token' )
11
+ /* eslint-disable-next-line unicorn/no-process-exit */
12
+ process . exit ( )
13
+ }
14
+
7
15
var outpath = path . join ( 'data' , 'sponsors.json' )
8
16
var min = 5
9
17
@@ -41,7 +49,7 @@ fetch(endpoint, {
41
49
body : JSON . stringify ( { query : query , variables : variables } ) ,
42
50
headers : {
43
51
'Content-Type' : 'application/json' ,
44
- 'Api-Key' : process . env . OC_TOKEN
52
+ 'Api-Key' : token
45
53
}
46
54
} )
47
55
. then ( res => res . json ( ) )
Original file line number Diff line number Diff line change @@ -5,7 +5,15 @@ var fetch = require('node-fetch')
5
5
6
6
require ( 'dotenv' ) . config ( )
7
7
8
- var headers = { Authorization : 'bearer ' + process . env . GH_TOKEN }
8
+ var ghToken = process . env . GH_TOKEN
9
+
10
+ if ( ! ghToken ) {
11
+ console . log ( 'Cannot crawl team without GH token' )
12
+ /* eslint-disable-next-line unicorn/no-process-exit */
13
+ process . exit ( )
14
+ }
15
+
16
+ var headers = { Authorization : 'bearer ' + ghToken }
9
17
10
18
var base = 'https://raw.githubusercontent.com/unifiedjs/collective/master/data/'
11
19
var files = [ 'humans.yml' , 'teams.yml' ]
You can’t perform that action at this time.
0 commit comments