forked from npm/statusboard
-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.js
93 lines (88 loc) · 2.36 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
87
88
89
90
91
92
93
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 = []
const accounts = [
'the-guild-org',
'Urigo',
'dotansimha',
'kamilkisiela',
'ardatan',
'B2o5T',
'enisdenjo',
'gilgardosh',
'saihaj',
'n1ru4l',
'TuvalSimha',
'graphql'
]
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 = `${accounts.map(a => `org:${a}`).join(' ')} topic:the-guild 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,
// 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,
}
},
},
},
}