forked from octokit/webhooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoctokit-webhooks.js
executable file
·43 lines (39 loc) · 1.06 KB
/
octokit-webhooks.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
#!/usr/bin/env node
const checkOrUpdateWebhooks = require('../lib/check-or-update-webhooks')
const { cached, _: [command] } = require('yargs')
.command('update', 'Update webhooks', yargs => {
yargs
.options({
cached: {
describe: 'Load HTML from local cache',
type: 'boolean',
default: false
}
})
.example('$0 update --cached')
})
.command('check', 'Check if webhooks are up-to-date', yargs => {
yargs
.options({
cached: {
describe: 'Load HTML from local cache',
type: 'boolean',
default: false
}
})
.example('$0 check --cached')
})
.help('h')
.alias('h', ['help', 'usage'])
.demandCommand(1, '')
.usage('bin/octokit-webhooks.js <command> [--cached]')
.argv
if (!['update', 'check'].includes(command)) {
console.log(`"${command}" must be one of: update, check`)
process.exit(1)
}
checkOrUpdateWebhooks({ cached, checkOnly: command === 'check' })
.catch(error => {
console.log(error.stack)
process.exit(1)
})