module to fire true[X] application team webhooks
// this file exists just to name the gist, and because gist ordering is asciibetical, it's name starts with a capital letter. |
const path = require('path'); | |
const getRepoInfo = require('git-repo-info'); | |
const slackWebhook = require('slack-webhook'); | |
module.exports = (env, webhookUrls) => { | |
const info = getRepoInfo(); | |
const projectName = path.basename(info.root); | |
const message = `deployed env=${env} <https://github.com/socialvibe/${projectName}/tree/${ | |
info.branch | |
}|${projectName}> (${info.branch})! | [<https://github.com/socialvibe/${projectName}/commit/${info.sha}|${ | |
info.sha | |
}>]`; | |
// slack-webhook ojbects | |
const slackWebhookObjects = webhookUrls.map((url) => { | |
return new slackWebhook(url) | |
}); | |
return Promise.all( | |
slackWebhookObjects.map((s) => { | |
return s.send(message); | |
}), | |
); | |
}; |
{ | |
"name": "application-project-slack-webhooks", | |
"version": "0.1.0" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment