Last active
February 15, 2018 02:01
-
-
Save gnitnuj/1b12b00c7993f37dc6e392623990b9e0 to your computer and use it in GitHub Desktop.
module to fire true[X] application team webhooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this file exists just to name the gist, and because gist ordering is asciibetical, it's name starts with a capital letter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}), | |
); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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