8000 Remove crawling without tokens · jletey/unifiedjs.github.io@9565134 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9565134

Browse files
committed
Remove crawling without tokens
1 parent 07df78b commit 9565134

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

crawl/ecosystem.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ var pAll = require('p-all')
99

1010
require('dotenv').config()
1111

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+
1221
var topics = require('../generate/util/constant-topic')
1322
var orgs = require('../generate/util/constant-collective')
1423

@@ -47,8 +56,8 @@ var main = promisify(
4756
)
4857

4958
main({
50-
ghToken: process.env.GH_TOKEN,
51-
npmToken: process.env.NPM_TOKEN,
59+
ghToken,
60+
npmToken,
5261
repos: [],
5362
topics: topics,
5463
orgs: orgs

crawl/sponsors.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ var fetch = require('node-fetch')
44

55
require('dotenv').config()
66

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+
715
var outpath = path.join('data', 'sponsors.json')
816
var min = 5
917

@@ -41,7 +49,7 @@ fetch(endpoint, {
4149
body: JSON.stringify({query: query, variables: variables}),
4250
headers: {
4351
'Content-Type': 'application/json',
44-
'Api-Key': process.env.OC_TOKEN
52+
'Api-Key': token
4553
}
4654
})
4755
.then(res => res.json())

crawl/team.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ var fetch = require('node-fetch')
55

66
require('dotenv').config()
77

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}
917

1018
var base = 'https://raw.githubusercontent.com/unifiedjs/collective/master/data/'
1119
var files = ['humans.yml', 'teams.yml']

0 commit comments

Comments
 (0)
0