Skip to content

Commit

Permalink
feat: add slack webhook to create-release-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
DaRaFF committed Feb 27, 2019
1 parent 342568b commit e16f140
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/commands/create-release-branch.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
const slackMessenger = require('slack-messenger')

module.exports = function (dep) {
const { logBgMagenta, logRed, logYellow } = dep
const cmd = {}
cmd.command = 'create-release-branch'
cmd.desc = 'Create a release branch'
cmd.builder = {
'repo': {
alias: 'r',
describe: "github repository name e.g. 'livingdocs-editor'",
demandOption: true
},
'base-tag': {
alias: 't',
describe: "Base tag where the release branch will be branched from e.g. '--base-tag v55.0.0'",
Expand All @@ -19,6 +26,10 @@ module.exports = function (dep) {
describe: "NPM token with write access e.g. '11111111-2222-3333-4444-555555555555'",
demandOption: getNpmTokenSetting(dep)
},
'slack-webhook-url': {
describe: "a webhook url e.g. 'https://hooks.slack.com/services/777/888/999' to inform a channel of the successful branch creation",
demandOption: false
},
'dry-run': {
alias: 'd',
describe: "No execution of the script (just logs) '--dry-run true' (default: false)",
Expand All @@ -45,7 +56,14 @@ module.exports = function (dep) {
.then(() => { return dep.shNpmPublish(argv) })
.then(() => { return dep.gitCommitPushReleaseBranch(argv) })
.then((value) => {
console.log('this is the end!')
if (argv.slackWebhookUrl) {
slackMessenger({
webhookUrl: argv.slackWebhookUrl,
message: `\`${argv.repo}\`: The upstream release branch \`${argv.releaseBranchName}\` has been created sucessfully`
})
}

console.log('Job done!')
})
.catch((err) => {
logRed(err.message)
Expand Down

0 comments on commit e16f140

Please sign in to comment.