forked from npm/statusboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
86 lines (80 loc) · 2.32 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
require('dotenv').config()
const { parseArgs } = require('util')
const { re, src, tokens } = require('semver')
const getVersion = (str = '') => str.match(re[tokens.FULLPLAIN])?.[0]
// workspace releases include a context between the word release and the version
const isRootRelease = (str = '') => str.match(new RegExp(`: release ${src[tokens.FULLPLAIN]}$`))
const denyRepoNames = [
'npm/node',
'npm/npm-cli-release-please',
'npm/release-please',
]
const denyCheckRuns = /^nodejs@\w+\sintegration\s/
const {
// add a delay between requests in CI since the built in GH tokens
// on actions seem to be more susceptible to secondary rate limits
delay = process.env.CI ? 1000 : 0,
repoQuery = 'org:npm topic:npm-cli fork:true is:public',
issueAndPrQuery = 'is:open',
noWrite = false,
} = parseArgs({
options: {
delay: {
type: 'string',
},
repoQuery: {
type: 'string',
},
issueAndPrQuery: {
type: 'string',
},
noWrite: {
type: 'boolean',
},
},
}).values
module.exports = {
auth: process.env.AUTH_TOKEN,
delay: +delay,
write: !noWrite,
repoQuery,
issueAndPrQuery,
checkRunFilter: (name) => !denyCheckRuns.test(name),
// Return null to fallback to other filters
repoFilter: (p) => denyRepoNames.includes(`${p.repo.owner}/${p.repo.name}`) ? false : null,
discussionQuery: 'answerChosenAt',
discussionFilter: {
unanswered: {
filter: (discussion) => !!discussion.answerChosenAt,
url: 'is:unanswered',
},
},
issueFilter: {
unlabeled: {
filter: (issue) => issue.labels.length === 0,
url: 'no:label',
},
priority: {
filter: (issue) => issue.labels.some(l => l.name === 'Priority 1' || l.name === 'Priority 0'),
url: 'label:"Priority 1","Priority 0',
},
triage: {
filter: (issue) => issue.labels.some(l => l.name === 'Needs Triage'),
url: 'label:"Needs Triage"',
},
},
prFilter: {
release: {
find: (issue) => {
const match = issue.labels.some(l => l.name === 'autorelease: pending') &&
// only include root releases for now
// TODO: workspace issue and pr management/filtering
isRootRelease(issue.title)
return match && {
url: issue.html_url,
version: getVersion(issue.title) || issue.title,
}
},
},
},
}