forked from sindresorhus/is-github-down
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
·34 lines (29 loc) · 912 Bytes
/
cli.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
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const got = require('got');
meow(`
Usage
$ is-github-down
🦄 It's down. Play with your 😸/🐶! And stay home!
`);
(async () => {
const {status} = await got('https://kctbh9vrtdwd.statuspage.io/api/v2/summary.json', {
timeout: 10000,
retry: 2
}).json();
if (['major', 'critical'].includes(status.indicator)) {
console.log('\n🦄 It\'s down. Play with your 😸/🐶! And stay home!\n');
console.log('Status page: https://githubstatus.com');
process.exitCode = 1;
return;
}
if (status.indicator === 'minor') {
console.log('\n🤔 There might be some issues. Probably better to play with your 😸/🐶 instead! Also stay at home!\n');
console.log('Status page: https://githubstatus.com');
process.exitCode = 1;
return;
}
console.error('\n 🐈 It\'s up. Go back to work!');
process.exitCode = 0;
})();