diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81ecd71..3fcf166 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,5 +43,3 @@ jobs: with: overall_threshold: minor pages_threshold: partial_outage - env: - GHACTION_GITHUB_STATUS_MOCKIT: true diff --git a/__tests__/fixtures/data-status-2.json b/__tests__/fixtures/data-status-2.json new file mode 100644 index 0000000..cfd2380 --- /dev/null +++ b/__tests__/fixtures/data-status-2.json @@ -0,0 +1,13 @@ +{ + "page": { + "id": "kctbh9vrtdwd", + "name": "GitHub", + "url": "https://www.githubstatus.com", + "time_zone": "Etc/UTC", + "updated_at": "2020-12-17T00:54:37.709Z" + }, + "status": { + "indicator": "maintenance", + "description": "Service Under Maintenance" + } +} diff --git a/__tests__/data-status.json b/__tests__/fixtures/data-status.json similarity index 100% rename from __tests__/data-status.json rename to __tests__/fixtures/data-status.json diff --git a/__tests__/fixtures/data-summary-2.json b/__tests__/fixtures/data-summary-2.json new file mode 100644 index 0000000..697ea7b --- /dev/null +++ b/__tests__/fixtures/data-summary-2.json @@ -0,0 +1,240 @@ +{ + "page": { + "id": "kctbh9vrtdwd", + "name": "GitHub", + "url": "https://www.githubstatus.com", + "time_zone": "Etc/UTC", + "updated_at": "2020-12-17T00:54:37.709Z" + }, + "components": [ + { + "id": "8l4ygp009s5s", + "name": "Git Operations", + "status": "operational", + "created_at": "2017-01-31T20:05:05.370Z", + "updated_at": "2020-10-29T22:51:43.831Z", + "position": 1, + "description": "Performance of git clones, pulls, pushes, and associated operations", + "showcase": false, + "start_date": null, + "group_id": null, + "page_id": "kctbh9vrtdwd", + "group": false, + "only_show_if_degraded": false + }, + { + "id": "brv1bkgrwx7q", + "name": "API Requests", + "status": "operational", + "created_at": "2017-01-31T20:01:46.621Z", + "updated_at": "2020-12-17T00:54:20.946Z", + "position": 2, + "description": "Requests for GitHub APIs", + "showcase": false, + "start_date": null, + "group_id": null, + "page_id": "kctbh9vrtdwd", + "group": false, + "only_show_if_degraded": false + }, + { + "id": "4230lsnqdsld", + "name": "Webhooks", + "status": "operational", + "created_at": "2019-11-13T18:00:24.256Z", + "updated_at": "2020-11-18T23:38:14.467Z", + "position": 3, + "description": "Real time HTTP callbacks of user-generated and system events", + "showcase": false, + "start_date": null, + "group_id": null, + "page_id": "kctbh9vrtdwd", + "group": false, + "only_show_if_degraded": false + }, + { + "id": "0l2p9nhqnxpd", + "name": "Visit www.githubstatus.com for more information", + "status": "operational", + "created_at": "2018-12-05T19:39:40.838Z", + "updated_at": "2020-04-02T21:56:21.954Z", + "position": 4, + "description": null, + "showcase": false, + "start_date": null, + "group_id": null, + "page_id": "kctbh9vrtdwd", + "group": false, + "only_show_if_degraded": false + }, + { + "id": "kr09ddfgbfsf", + "name": "Issues", + "status": "operational", + "created_at": "2017-01-31T20:01:46.638Z", + "updated_at": "2020-12-17T00:54:24.999Z", + "position": 5, + "description": "Requests for Issues on GitHub.com", + "showcase": false, + "start_date": null, + "group_id": null, + "page_id": "kctbh9vrtdwd", + "group": false, + "only_show_if_degraded": false + }, + { + "id": "hhtssxt0f5v2", + "name": "Pull Requests", + "status": "operational", + "created_at": "2020-09-02T15:39:06.329Z", + "updated_at": "2020-12-17T00:54:27.674Z", + "position": 6, + "description": "Requests for Pull Requests on GitHub.com", + "showcase": false, + "start_date": null, + "group_id": null, + "page_id": "kctbh9vrtdwd", + "group": false, + "only_show_if_degraded": false + }, + { + "id": "br0l2tvcx85d", + "name": "GitHub Actions", + "status": "under_maintenance", + "created_at": "2019-11-13T18:02:19.432Z", + "updated_at": "2020-12-15T10:00:40.029Z", + "position": 7, + "description": "Workflows, Compute and Orchestration for GitHub Actions", + "showcase": false, + "start_date": null, + "group_id": null, + "page_id": "kctbh9vrtdwd", + "group": false, + "only_show_if_degraded": false + }, + { + "id": "st3j38cctv9l", + "name": "GitHub Packages", + "status": "operational", + "created_at": "2019-11-13T18:02:40.064Z", + "updated_at": "2020-12-17T00:54:37.707Z", + "position": 8, + "description": "API requests and webhook delivery for GitHub Packages", + "showcase": false, + "start_date": null, + "group_id": null, + "page_id": "kctbh9vrtdwd", + "group": false, + "only_show_if_degraded": false + }, + { + "id": "vg70hn9s2tyj", + "name": "GitHub Pages", + "status": "operational", + "created_at": "2017-01-31T20:04:33.923Z", + "updated_at": "2020-10-10T00:02:38.220Z", + "position": 9, + "description": "Frontend application and API servers for Pages builds", + "showcase": false, + "start_date": null, + "group_id": null, + "page_id": "kctbh9vrtdwd", + "group": false, + "only_show_if_degraded": false + } + ], + "incidents": [], + "scheduled_maintenances": [ + { + "id": "3jr0nb7zjpbm", + "name": "macOS virtual environment maintenance", + "status": "in_progress", + "created_at": "2020-12-14T16:37:35.904Z", + "updated_at": "2020-12-15T10:00:40.058Z", + "monitoring_at": null, + "resolved_at": null, + "impact": "maintenance", + "shortlink": "https://stspg.io/rm0t69d0btrr", + "started_at": "2020-12-14T16:37:35.898Z", + "page_id": "kctbh9vrtdwd", + "incident_updates": [ + { + "id": "f0421g6r1g8m", + "status": "in_progress", + "body": "Scheduled maintenance is currently in progress. We will provide updates as necessary.", + "incident_id": "3jr0nb7zjpbm", + "created_at": "2020-12-15T10:00:40.056Z", + "updated_at": "2020-12-15T10:00:40.056Z", + "display_at": "2020-12-15T10:00:40.056Z", + "affected_components": [ + { + "code": "br0l2tvcx85d", + "name": "GitHub Actions", + "old_status": "operational", + "new_status": "under_maintenance" + } + ], + "deliver_notifications": true, + "custom_tweet": null, + "tweet_id": null + }, + { + "id": "vrs2hgm4k8th", + "status": "scheduled", + "body": "Maintenance will begin as scheduled in 60 minutes.", + "incident_id": "3jr0nb7zjpbm", + "created_at": "2020-12-15T09:00:29.617Z", + "updated_at": "2020-12-15T09:00:29.617Z", + "display_at": "2020-12-15T09:00:29.617Z", + "affected_components": null, + "deliver_notifications": true, + "custom_tweet": null, + "tweet_id": null + }, + { + "id": "9byn0w0j9hyg", + "status": "scheduled", + "body": "During the week of December 14-18, GitHub will be performing scheduled maintenance on one of our datacenters that may result in longer than normal queue times for macOS workflows using macos-latest, macos-10.14, or macos-10.15. In some cases, it may be possible that jobs will time out or be cancelled, and will need to be restarted.\n\nWe apologize for the inconvenience and encourage you to be patient, and give your workflows extra time to run. Follow our progress in the virtual-environments repo here.", + "incident_id": "3jr0nb7zjpbm", + "created_at": "2020-12-14T16:37:35.959Z", + "updated_at": "2020-12-14T16:37:35.959Z", + "display_at": "2020-12-14T16:37:35.959Z", + "affected_components": [ + { + "code": "br0l2tvcx85d", + "name": "GitHub Actions", + "old_status": "operational", + "new_status": "operational" + } + ], + "deliver_notifications": true, + "custom_tweet": null, + "tweet_id": null + } + ], + "components": [ + { + "id": "br0l2tvcx85d", + "name": "GitHub Actions", + "status": "under_maintenance", + "created_at": "2019-11-13T18:02:19.432Z", + "updated_at": "2020-12-15T10:00:40.029Z", + "position": 7, + "description": "Workflows, Compute and Orchestration for GitHub Actions", + "showcase": false, + "start_date": null, + "group_id": null, + "page_id": "kctbh9vrtdwd", + "group": false, + "only_show_if_degraded": false + } + ], + "scheduled_for": "2020-12-15T10:00:00.000Z", + "scheduled_until": "2020-12-19T04:00:00.000Z" + } + ], + "status": { + "indicator": "maintenance", + "description": "Service Under Maintenance" + } +} diff --git a/__tests__/data-summary.json b/__tests__/fixtures/data-summary.json similarity index 100% rename from __tests__/data-summary.json rename to __tests__/fixtures/data-summary.json diff --git a/__tests__/githubstatus.test.ts b/__tests__/githubstatus.test.ts index c077669..d180568 100644 --- a/__tests__/githubstatus.test.ts +++ b/__tests__/githubstatus.test.ts @@ -1,4 +1,7 @@ +import * as path from 'path'; import * as githubstatus from '../src/githubstatus'; +import {Page, Status} from '../src/status'; +import {Summary} from '../src/summary'; describe('githubstatus', () => { it('returns GitHub Status (status)', async () => { @@ -14,3 +17,62 @@ describe('githubstatus', () => { expect(summary?.components?.length).toBeGreaterThan(0); }); }); + +describe('status', () => { + test.each([ + [ + 'data-status.json', + { + description: 'Minor Service Outage', + indicator: 'minor' + } as Status, + { + id: 'kctbh9vrtdwd', + name: 'GitHub', + url: 'https://www.githubstatus.com', + time_zone: 'Etc/UTC', + updated_at: '2020-05-22T20:50:20.457Z' + } as Page + ], + [ + 'data-status-2.json', + { + description: 'Service Under Maintenance', + indicator: 'maintenance' + } as Status, + { + id: 'kctbh9vrtdwd', + name: 'GitHub', + url: 'https://www.githubstatus.com', + time_zone: 'Etc/UTC', + updated_at: '2020-12-17T00:54:37.709Z' + } as Page + ] + ])('given %p', async (file, expStatus, expPage) => { + jest.spyOn(githubstatus, 'status').mockImplementation( + (): Promise => { + return >require(path.join(__dirname, 'fixtures', file)); + } + ); + + const status = await githubstatus.status(); + console.log(status); + expect(status?.status).toEqual(expStatus); + expect(status?.page).toEqual(expPage); + }); +}); + +describe('summary', () => { + test.each([['data-summary.json'], ['data-summary-2.json']])('given %p', async file => { + jest.spyOn(githubstatus, 'summary').mockImplementation( + (): Promise => { + return >require(path.join(__dirname, 'fixtures', file)); + } + ); + + const summary = await githubstatus.summary(); + console.log(summary); + expect(summary?.status.indicator).not.toEqual(''); + expect(summary?.components?.length).toBeGreaterThan(0); + }); +}); diff --git a/dist/index.js b/dist/index.js index b2bd271..059f678 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2,22 +2,6 @@ module.exports = /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ 974: -/***/ ((module) => { - -"use strict"; -module.exports = JSON.parse("{\"page\":{\"id\":\"kctbh9vrtdwd\",\"name\":\"GitHub\",\"url\":\"https://www.githubstatus.com\",\"time_zone\":\"Etc/UTC\",\"updated_at\":\"2020-05-22T20:50:20.457Z\"},\"status\":{\"indicator\":\"minor\",\"description\":\"Minor Service Outage\"}}"); - -/***/ }), - -/***/ 675: -/***/ ((module) => { - -"use strict"; -module.exports = JSON.parse("{\"page\":{\"id\":\"kctbh9vrtdwd\",\"name\":\"GitHub\",\"url\":\"https://www.githubstatus.com\",\"time_zone\":\"Etc/UTC\",\"updated_at\":\"2020-05-22T20:50:20.457Z\"},\"components\":[{\"id\":\"8l4ygp009s5s\",\"name\":\"Git Operations\",\"status\":\"operational\",\"created_at\":\"2017-01-31T20:05:05.370Z\",\"updated_at\":\"2020-09-02T15:40:02.167Z\",\"position\":1,\"description\":\"Performance of git clones, pulls, pushes, and associated operations\",\"showcase\":false,\"start_date\":null,\"group_id\":null,\"page_id\":\"kctbh9vrtdwd\",\"group\":false,\"only_show_if_degraded\":false},{\"id\":\"brv1bkgrwx7q\",\"name\":\"API Requests\",\"status\":\"operational\",\"created_at\":\"2017-01-31T20:01:46.621Z\",\"updated_at\":\"2020-09-08T17:16:59.324Z\",\"position\":2,\"description\":\"Requests for GitHub APIs\",\"showcase\":false,\"start_date\":null,\"group_id\":null,\"page_id\":\"kctbh9vrtdwd\",\"group\":false,\"only_show_if_degraded\":false},{\"id\":\"4230lsnqdsld\",\"name\":\"Webhooks\",\"status\":\"operational\",\"created_at\":\"2019-11-13T18:00:24.256Z\",\"updated_at\":\"2020-09-07T01:36:09.887Z\",\"position\":3,\"description\":\"Real time HTTP callbacks of user-generated and system events\",\"showcase\":false,\"start_date\":null,\"group_id\":null,\"page_id\":\"kctbh9vrtdwd\",\"group\":false,\"only_show_if_degraded\":false},{\"id\":\"0l2p9nhqnxpd\",\"name\":\"Visit www.githubstatus.com for more information\",\"status\":\"operational\",\"created_at\":\"2018-12-05T19:39:40.838Z\",\"updated_at\":\"2020-04-02T21:56:21.954Z\",\"position\":4,\"description\":null,\"showcase\":false,\"start_date\":null,\"group_id\":null,\"page_id\":\"kctbh9vrtdwd\",\"group\":false,\"only_show_if_degraded\":false},{\"id\":\"kr09ddfgbfsf\",\"name\":\"Issues\",\"status\":\"operational\",\"created_at\":\"2017-01-31T20:01:46.638Z\",\"updated_at\":\"2020-09-08T16:14:03.625Z\",\"position\":5,\"description\":\"Requests for Issues on GitHub.com\",\"showcase\":false,\"start_date\":null,\"group_id\":null,\"page_id\":\"kctbh9vrtdwd\",\"group\":false,\"only_show_if_degraded\":false},{\"id\":\"hhtssxt0f5v2\",\"name\":\"Pull Requests\",\"status\":\"operational\",\"created_at\":\"2020-09-02T15:39:06.329Z\",\"updated_at\":\"2020-09-08T16:14:05.407Z\",\"position\":6,\"description\":\"Requests for Pull Requests on GitHub.com\",\"showcase\":false,\"start_date\":null,\"group_id\":null,\"page_id\":\"kctbh9vrtdwd\",\"group\":false,\"only_show_if_degraded\":false},{\"id\":\"br0l2tvcx85d\",\"name\":\"GitHub Actions\",\"status\":\"operational\",\"created_at\":\"2019-11-13T18:02:19.432Z\",\"updated_at\":\"2020-09-02T15:40:47.790Z\",\"position\":7,\"description\":\"Workflows, Compute and Orchestration for GitHub Actions\",\"showcase\":false,\"start_date\":null,\"group_id\":null,\"page_id\":\"kctbh9vrtdwd\",\"group\":false,\"only_show_if_degraded\":false},{\"id\":\"st3j38cctv9l\",\"name\":\"GitHub Packages\",\"status\":\"operational\",\"created_at\":\"2019-11-13T18:02:40.064Z\",\"updated_at\":\"2020-09-08T15:50:32.845Z\",\"position\":8,\"description\":\"API requests and webhook delivery for GitHub Packages\",\"showcase\":false,\"start_date\":null,\"group_id\":null,\"page_id\":\"kctbh9vrtdwd\",\"group\":false,\"only_show_if_degraded\":false},{\"id\":\"vg70hn9s2tyj\",\"name\":\"GitHub Pages\",\"status\":\"operational\",\"created_at\":\"2017-01-31T20:04:33.923Z\",\"updated_at\":\"2020-09-17T16:30:28.895Z\",\"position\":9,\"description\":\"Frontend application and API servers for Pages builds\",\"showcase\":false,\"start_date\":null,\"group_id\":null,\"page_id\":\"kctbh9vrtdwd\",\"group\":false,\"only_show_if_degraded\":false}],\"incidents\":[{\"id\":\"6tcfpztf6j9m\",\"name\":\"Incident on 2020-05-22 16:41 UTC\",\"status\":\"investigating\",\"created_at\":\"2020-05-22T16:41:53.142Z\",\"updated_at\":\"2020-05-22T20:50:13.761Z\",\"monitoring_at\":null,\"resolved_at\":null,\"impact\":\"minor\",\"shortlink\":\"http://stspg.io/g1l6nqnlv29b\",\"started_at\":\"2020-05-22T16:41:53.133Z\",\"page_id\":\"kctbh9vrtdwd\",\"incident_updates\":[{\"id\":\"2hdg5g90ysg5\",\"status\":\"investigating\",\"body\":\"The last incident update was due to the ongoing remediation work. We have addressed that issue and continue to monitor the original issue.\",\"incident_id\":\"6tcfpztf6j9m\",\"created_at\":\"2020-05-22T20:50:13.759Z\",\"updated_at\":\"2020-05-22T20:50:13.759Z\",\"display_at\":\"2020-05-22T20:50:13.759Z\",\"affected_components\":null,\"deliver_notifications\":true,\"custom_tweet\":null,\"tweet_id\":null},{\"id\":\"jwx4zzg89qxk\",\"status\":\"investigating\",\"body\":\"We are also investigating elevated error rates for GitHub.com.\",\"incident_id\":\"6tcfpztf6j9m\",\"created_at\":\"2020-05-22T19:57:28.380Z\",\"updated_at\":\"2020-05-22T19:57:28.380Z\",\"display_at\":\"2020-05-22T19:57:28.380Z\",\"affected_components\":null,\"deliver_notifications\":true,\"custom_tweet\":null,\"tweet_id\":null},{\"id\":\"2v0t4679xdb0\",\"status\":\"investigating\",\"body\":\"We continue to monitor the remediation and will provide the next update in 1 hour.\",\"incident_id\":\"6tcfpztf6j9m\",\"created_at\":\"2020-05-22T19:17:05.205Z\",\"updated_at\":\"2020-05-22T19:17:05.205Z\",\"display_at\":\"2020-05-22T19:17:05.205Z\",\"affected_components\":null,\"deliver_notifications\":true,\"custom_tweet\":null,\"tweet_id\":null},{\"id\":\"2vsfbxp44rcy\",\"status\":\"investigating\",\"body\":\"We have identified the source causing elevated errors as well as occasional stale data on GitHub.com. We are working on remediation.\",\"incident_id\":\"6tcfpztf6j9m\",\"created_at\":\"2020-05-22T18:01:25.988Z\",\"updated_at\":\"2020-05-22T18:01:25.988Z\",\"display_at\":\"2020-05-22T18:01:25.988Z\",\"affected_components\":null,\"deliver_notifications\":true,\"custom_tweet\":null,\"tweet_id\":null},{\"id\":\"v2jscrdmsw38\",\"status\":\"investigating\",\"body\":\"We continue to investigate an increase in errors on GitHub.com.\",\"incident_id\":\"6tcfpztf6j9m\",\"created_at\":\"2020-05-22T17:16:39.703Z\",\"updated_at\":\"2020-05-22T17:16:39.703Z\",\"display_at\":\"2020-05-22T17:16:39.703Z\",\"affected_components\":null,\"deliver_notifications\":true,\"custom_tweet\":null,\"tweet_id\":null},{\"id\":\"3ry2b0s8174c\",\"status\":\"investigating\",\"body\":\"We are investigating an increase in errors on GitHub.com.\",\"incident_id\":\"6tcfpztf6j9m\",\"created_at\":\"2020-05-22T16:41:53.189Z\",\"updated_at\":\"2020-05-22T16:41:53.189Z\",\"display_at\":\"2020-05-22T16:41:53.189Z\",\"affected_components\":[{\"code\":\"0l2p9nhqnxpd\",\"name\":\"Visit www.githubstatus.com for more information\",\"old_status\":\"operational\",\"new_status\":\"operational\"}],\"deliver_notifications\":true,\"custom_tweet\":null,\"tweet_id\":null}],\"components\":[{\"id\":\"0l2p9nhqnxpd\",\"name\":\"Visit www.githubstatus.com for more information\",\"status\":\"operational\",\"created_at\":\"2018-12-05T19:39:40.838Z\",\"updated_at\":\"2020-04-02T21:56:21.954Z\",\"position\":4,\"description\":null,\"showcase\":false,\"group_id\":null,\"page_id\":\"kctbh9vrtdwd\",\"group\":false,\"only_show_if_degraded\":false}]}],\"scheduled_maintenances\":[{\"id\":\"skzhfwy9kf8q\",\"name\":\"Deprecating password authentication\",\"status\":\"scheduled\",\"created_at\":\"2020-09-14T09:33:28.071Z\",\"updated_at\":\"2020-09-14T09:36:29.610Z\",\"monitoring_at\":null,\"resolved_at\":null,\"impact\":\"maintenance\",\"shortlink\":\"http://stspg.io/z0gf9ffzy530\",\"started_at\":\"2020-09-14T09:33:28.065Z\",\"page_id\":\"kctbh9vrtdwd\",\"incident_updates\":[{\"id\":\"xwjsnptt3v4g\",\"status\":\"scheduled\",\"body\":\"As mentioned in our developer guide, GitHub no longer supports basic authentication using a username and password. Instead, we recommend using personal access tokens or the web application flow.\",\"incident_id\":\"skzhfwy9kf8q\",\"created_at\":\"2020-09-14T09:33:28.126Z\",\"updated_at\":\"2020-09-14T09:36:29.607Z\",\"display_at\":\"2020-09-14T09:33:28.126Z\",\"affected_components\":[{\"code\":\"brv1bkgrwx7q\",\"name\":\"API Requests\",\"old_status\":\"operational\",\"new_status\":\"operational\"}],\"deliver_notifications\":true,\"custom_tweet\":null,\"tweet_id\":null}],\"components\":[{\"id\":\"brv1bkgrwx7q\",\"name\":\"API Requests\",\"status\":\"operational\",\"created_at\":\"2017-01-31T20:01:46.621Z\",\"updated_at\":\"2020-09-08T17:16:59.324Z\",\"position\":2,\"description\":\"Requests for GitHub APIs\",\"showcase\":false,\"start_date\":null,\"group_id\":null,\"page_id\":\"kctbh9vrtdwd\",\"group\":false,\"only_show_if_degraded\":false}],\"scheduled_for\":\"2020-09-30T07:00:00.000Z\",\"scheduled_until\":\"2020-09-30T10:00:00.000Z\"},{\"id\":\"ry5psbndh11j\",\"name\":\"Deprecating password authentication\",\"status\":\"scheduled\",\"created_at\":\"2020-09-14T09:34:09.320Z\",\"updated_at\":\"2020-09-14T09:35:34.843Z\",\"monitoring_at\":null,\"resolved_at\":null,\"impact\":\"maintenance\",\"shortlink\":\"http://stspg.io/r7b3cwdr1hll\",\"started_at\":\"2020-09-14T09:34:09.316Z\",\"page_id\":\"kctbh9vrtdwd\",\"incident_updates\":[{\"id\":\"9pyd05dq9dmh\",\"status\":\"scheduled\",\"body\":\"As mentioned in our developer guide, GitHub no longer supports basic authentication using a username and password. Instead, we recommend using personal access tokens or the web application flow.\",\"incident_id\":\"ry5psbndh11j\",\"created_at\":\"2020-09-14T09:34:09.369Z\",\"updated_at\":\"2020-09-14T09:35:34.841Z\",\"display_at\":\"2020-09-14T09:34:09.369Z\",\"affected_components\":[{\"code\":\"brv1bkgrwx7q\",\"name\":\"API Requests\",\"old_status\":\"operational\",\"new_status\":\"operational\"}],\"deliver_notifications\":true,\"custom_tweet\":null,\"tweet_id\":null}],\"components\":[{\"id\":\"brv1bkgrwx7q\",\"name\":\"API Requests\",\"status\":\"operational\",\"created_at\":\"2017-01-31T20:01:46.621Z\",\"updated_at\":\"2020-09-08T17:16:59.324Z\",\"position\":2,\"description\":\"Requests for GitHub APIs\",\"showcase\":false,\"start_date\":null,\"group_id\":null,\"page_id\":\"kctbh9vrtdwd\",\"group\":false,\"only_show_if_degraded\":false}],\"scheduled_for\":\"2020-09-30T16:00:00.000Z\",\"scheduled_until\":\"2020-09-30T19:00:00.000Z\"}],\"status\":{\"indicator\":\"minor\",\"description\":\"Minor Service Outage\"}}"); - -/***/ }), - /***/ 779: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { @@ -113,19 +97,10 @@ exports.getComponentStatusName = (status) => __awaiter(void 0, void 0, void 0, f } }); exports.status = () => __awaiter(void 0, void 0, void 0, function* () { - yield console.log(process.env); - if (process.env.GHACTION_GITHUB_STATUS_MOCKIT) { - // @ts-ignore - return __webpack_require__(974); - } const http = new httpm.HttpClient('ghaction-github-status'); return (yield http.getJson(`https://www.githubstatus.com/api/v2/status.json`)).result; }); exports.summary = () => __awaiter(void 0, void 0, void 0, function* () { - if (process.env.GHACTION_GITHUB_STATUS_MOCKIT) { - // @ts-ignore - return __webpack_require__(675); - } const http = new httpm.HttpClient('ghaction-github-status'); return (yield http.getJson(`https://www.githubstatus.com/api/v2/summary.json`)).result; }); @@ -223,6 +198,10 @@ function run() { compStatusText = chalk.green('Operational'); break; } + case 'under_maintenance': { + compStatusText = chalk.blue('Under maintenance'); + break; + } case 'degraded_performance': { compStatusText = chalk.magenta('Degraded performance'); break; diff --git a/src/githubstatus.ts b/src/githubstatus.ts index 5485d90..17a6eac 100644 --- a/src/githubstatus.ts +++ b/src/githubstatus.ts @@ -53,20 +53,11 @@ export const getComponentStatusName = async (status: ComponentStatus): Promise => { - await console.log(process.env); - if (process.env.GHACTION_GITHUB_STATUS_MOCKIT) { - // @ts-ignore - return require('../__tests__/data-status.json'); - } const http: httpm.HttpClient = new httpm.HttpClient('ghaction-github-status'); return (await http.getJson(`https://www.githubstatus.com/api/v2/status.json`)).result; }; export const summary = async (): Promise => { - if (process.env.GHACTION_GITHUB_STATUS_MOCKIT) { - // @ts-ignore - return require('../__tests__/data-summary.json'); - } const http: httpm.HttpClient = new httpm.HttpClient('ghaction-github-status'); return (await http.getJson(`https://www.githubstatus.com/api/v2/summary.json`)).result; }; diff --git a/src/main.ts b/src/main.ts index 7c3360d..349780d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -78,6 +78,10 @@ async function run() { compStatusText = chalk.green('Operational'); break; } + case 'under_maintenance': { + compStatusText = chalk.blue('Under maintenance'); + break; + } case 'degraded_performance': { compStatusText = chalk.magenta('Degraded performance'); break;