ci - metamaskbot-announce - gracefully handle missing PR

feature/default_network_editable
kumavis 7 years ago
parent 92dd2b3218
commit 502a203218
  1. 13
      development/metamaskbot-build-announce.js

@ -2,6 +2,10 @@
const request = require('request-promise')
const VERSION = require('../dist/chrome/manifest.json').version
start().catch(console.error)
async function start() {
const GITHUB_COMMENT_TOKEN = process.env.GITHUB_COMMENT_TOKEN
const CIRCLE_PULL_REQUEST = process.env.CIRCLE_PULL_REQUEST
console.log('CIRCLE_PULL_REQUEST', CIRCLE_PULL_REQUEST)
@ -10,6 +14,11 @@ console.log('CIRCLE_SHA1', CIRCLE_SHA1)
const CIRCLE_BUILD_NUM = process.env.CIRCLE_BUILD_NUM
console.log('CIRCLE_BUILD_NUM', CIRCLE_BUILD_NUM)
if (!CIRCLE_PULL_REQUEST) {
console.warn(`No pull request detected for commit "${CIRCLE_SHA1}"`)
return
}
const CIRCLE_PR_NUMBER = CIRCLE_PULL_REQUEST.split('/').pop()
const SHORT_SHA1 = CIRCLE_SHA1.slice(0,7)
const BUILD_LINK_BASE = `https://${CIRCLE_BUILD_NUM}-42009758-gh.circle-artifacts.com/0`
@ -40,7 +49,7 @@ const POST_COMMENT_URI = `https://api.github.com/repos/metamask/metamask-extensi
console.log(`Announcement:\n${commentBody}`)
console.log(`Posting to: ${POST_COMMENT_URI}`)
request({
await request({
method: 'POST',
uri: POST_COMMENT_URI,
body: JSON_PAYLOAD,
@ -49,3 +58,5 @@ request({
'Authorization': `token ${GITHUB_COMMENT_TOKEN}`,
},
})
}

Loading…
Cancel
Save