diff --git a/development/metamaskbot-build-announce.js b/development/metamaskbot-build-announce.js index d9d887b2f..baf82a0f1 100755 --- a/development/metamaskbot-build-announce.js +++ b/development/metamaskbot-build-announce.js @@ -1,7 +1,7 @@ #!/usr/bin/env node const { promises: fs } = require('fs') const path = require('path') -const request = require('request-promise') +const fetch = require('node-fetch') const VERSION = require('../dist/chrome/manifest.json').version // eslint-disable-line import/no-unresolved start().catch(console.error) @@ -152,14 +152,15 @@ async function start () { console.log(`Announcement:\n${commentBody}`) console.log(`Posting to: ${POST_COMMENT_URI}`) - await request({ + const response = await fetch(POST_COMMENT_URI, { method: 'POST', - uri: POST_COMMENT_URI, body: JSON_PAYLOAD, headers: { 'User-Agent': 'metamaskbot', 'Authorization': `token ${GITHUB_COMMENT_TOKEN}`, }, }) - + if (!response.ok) { + throw new Error(`Post comment failed with status '${response.statusText}'`) + } } diff --git a/package.json b/package.json index 72ced8f71..165342a7b 100644 --- a/package.json +++ b/package.json @@ -171,7 +171,6 @@ "redux": "^3.0.5", "redux-logger": "^3.0.6", "redux-thunk": "^2.2.0", - "request-promise": "^4.2.1", "reselect": "^3.0.1", "rpc-cap": "^1.0.1", "safe-event-emitter": "^1.0.1", @@ -272,6 +271,7 @@ "mocha-jsdom": "^1.1.0", "mocha-sinon": "^2.0.0", "nock": "^9.0.14", + "node-fetch": "^2.6.0", "node-sass": "^4.12.0", "nyc": "^13.0.0", "path": "^0.12.7", diff --git a/yarn.lock b/yarn.lock index 2bdf8ae36..065cf54b2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23773,16 +23773,6 @@ request-promise-native@^1.0.3: stealthy-require "^1.1.0" tough-cookie ">=2.3.3" -request-promise@^4.2.1: - version "4.2.2" - resolved "https://registry.yarnpkg.com/request-promise/-/request-promise-4.2.2.tgz#d1ea46d654a6ee4f8ee6a4fea1018c22911904b4" - integrity sha1-0epG1lSm7k+O5qT+oQGMIpEZBLQ= - dependencies: - bluebird "^3.5.0" - request-promise-core "1.1.1" - stealthy-require "^1.1.0" - tough-cookie ">=2.3.3" - request@^2.45.0, request@^2.81.0, request@^2.83.0: version "2.87.0" resolved "https://registry.yarnpkg.com/request/-/request-2.87.0.tgz#32f00235cd08d482b4d0d68db93a829c0ed5756e"