diff --git a/bin/utils/flow.js b/bin/utils/flow.js index 44a08f3..0c022b2 100755 --- a/bin/utils/flow.js +++ b/bin/utils/flow.js @@ -8,7 +8,7 @@ const helper = require('./helper.js'); const kleur = require('kleur'); const axios = require('axios'); const octokit = new Octokit({ - auth: process.env.GITHUB_ACCESS_TOKEN || process.env.YABA_GITHUB_ACCESS_TOKEN + auth: process.env.YABA_GITHUB_ACCESS_TOKEN }); module.exports = { @@ -214,7 +214,7 @@ module.exports = { spinner.start('Sending release information to Slack channel...'); - const slackHookUrls = process.env.SLACK_HOOK_URL || process.env.YABA_SLACK_HOOK_URL; + const slackHookUrls = process.env.YABA_SLACK_HOOK_URL; if (!slackHookUrls) { spinner.fail("Release not announced on Slack: configuration not found!"); return; @@ -225,8 +225,6 @@ module.exports = { for (const channelUrl of slackHookUrlList) { await postToSlack(channelUrl, message); } - - spinner.succeed('Changelog published to Slack.'); } } } @@ -241,8 +239,12 @@ module.exports = { async function postToSlack(channelUrl, message) { await axios .post(channelUrl, message) + .then(function (response) { + spinner.succeed('Changelog published to Slack.'); + }) .catch(error => { - spinner.fail(`Something went wrong while sending to Slack channel: ${error}`) + spinner.fail(`Something went wrong while sending to Slack channel: ${error}`); + process.exit(); }); } diff --git a/bin/utils/helper.js b/bin/utils/helper.js index 903289f..d7c1839 100755 --- a/bin/utils/helper.js +++ b/bin/utils/helper.js @@ -107,7 +107,7 @@ module.exports = { * @returns {string} */ retrieveOwner: function (owner, username) { - return (owner || (process.env.GITHUB_REPO_OWNER || process.env.YABA_GITHUB_REPO_OWNER) || username); + return (owner || process.env.YABA_GITHUB_REPO_OWNER || username); }, /** @@ -140,7 +140,7 @@ module.exports = { * @returns {boolean} */ requiredEnvVariablesExist: function () { - if (process.env.GITHUB_ACCESS_TOKEN || process.env.YABA_GITHUB_ACCESS_TOKEN) { + if (process.env.YABA_GITHUB_ACCESS_TOKEN) { return true; } return false; diff --git a/package.json b/package.json index f195806..0c2d1fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yaba-release-cli", - "version": "1.5.3", + "version": "1.6.0", "description": "Yaba is a simple CLI tool that helps you manage releases of your Github projects.", "main": "bin/index.js", "scripts": {