├── .npmrc ├── .gitattributes ├── .gitignore ├── .editorconfig ├── test.js ├── readme.md ├── .github └── workflows │ └── main.yml ├── package.json ├── cli.js └── license /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | yarn.lock 3 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.yml] 11 | indent_style = space 12 | indent_size = 2 13 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import execa from 'execa'; 3 | 4 | test('main', async t => { 5 | let returnValue; 6 | 7 | try { 8 | const {stdout, stderr} = await execa('./cli.js'); 9 | returnValue = stdout || stderr; 10 | } catch (error) { 11 | const {stdout} = error; 12 | returnValue = stdout; 13 | } 14 | 15 | t.regex(returnValue, /down|up|issues/); 16 | }); 17 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # is-github-down 2 | 3 | > Check if GitHub is down 4 | 5 | ## Quick usage 6 | 7 | ```sh 8 | npx is-github-down 9 | ``` 10 | 11 | ## Install 12 | 13 | ```sh 14 | npm install --global is-github-down 15 | ``` 16 | 17 | ## Usage 18 | 19 | ``` 20 | $ is-github-down 21 | 22 | Usage 23 | $ is-github-down 24 | 🦄 It's down. Play with your 😸/🐶! And stay home! 25 | ``` 26 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | - push 4 | - pull_request 5 | jobs: 6 | test: 7 | name: Node.js ${{ matrix.node-version }} 8 | runs-on: ubuntu-latest 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | node-version: 13 | - 16 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: actions/setup-node@v2 17 | with: 18 | node-version: ${{ matrix.node-version }} 19 | - run: npm install 20 | - run: npm test 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "is-github-down", 3 | "version": "3.0.0", 4 | "description": "Check if GitHub is down", 5 | "license": "MIT", 6 | "repository": "sindresorhus/is-github-down", 7 | "funding": "https://github.com/sponsors/sindresorhus", 8 | "author": { 9 | "name": "Sindre Sorhus", 10 | "email": "sindresorhus@gmail.com", 11 | "url": "https://sindresorhus.com" 12 | }, 13 | "type": "module", 14 | "bin": "./cli.js", 15 | "engines": { 16 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0" 17 | }, 18 | "scripts": { 19 | "test": "xo && ava" 20 | }, 21 | "files": [ 22 | "cli.js" 23 | ], 24 | "keywords": [ 25 | "cli-app", 26 | "cli", 27 | "github", 28 | "down", 29 | "check", 30 | "up", 31 | "status" 32 | ], 33 | "dependencies": { 34 | "got": "^11.8.2", 35 | "meow": "^10.1.1" 36 | }, 37 | "devDependencies": { 38 | "ava": "^3.15.0", 39 | "execa": "^5.1.1", 40 | "xo": "^0.45.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import process from 'node:process'; 3 | import meow from 'meow'; 4 | import got from 'got'; 5 | 6 | meow(` 7 | Usage 8 | $ is-github-down 9 | 🦄 It's down. Play with your 😸/🐶! And stay home! 10 | `, { 11 | importMeta: import.meta, 12 | }); 13 | 14 | (async () => { 15 | const {status} = await got('https://kctbh9vrtdwd.statuspage.io/api/v2/summary.json', { 16 | timeout: 10_000, 17 | retry: 2, 18 | }).json(); 19 | 20 | if (['major', 'critical'].includes(status.indicator)) { 21 | console.log('\n🦄 It\'s down. Play with your 😸/🐶! And stay home!\n'); 22 | console.log('Status page: https://githubstatus.com'); 23 | process.exitCode = 1; 24 | return; 25 | } 26 | 27 | if (status.indicator === 'minor') { 28 | console.log('\n🤔 There might be some issues. Probably better to play with your 😸/🐶 instead! Also stay at home!\n'); 29 | console.log('Status page: https://githubstatus.com'); 30 | process.exitCode = 1; 31 | return; 32 | } 33 | 34 | console.error('\n 🐈 It\'s up. Go back to work!'); 35 | process.exitCode = 0; 36 | })(); 37 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sindre Sorhus (https://sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | --------------------------------------------------------------------------------