Skip to content

Instantly share code, notes, and snippets.

@gnitnuj
Last active February 15, 2018 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnitnuj/1b12b00c7993f37dc6e392623990b9e0 to your computer and use it in GitHub Desktop.
Save gnitnuj/1b12b00c7993f37dc6e392623990b9e0 to your computer and use it in GitHub Desktop.
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