Skip to content

Commit

Permalink
chore: rename env variables (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
volkanto authored Aug 25, 2021
1 parent 96d79b8 commit 898fb98
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions bin/utils/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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;
Expand All @@ -225,8 +225,6 @@ module.exports = {
for (const channelUrl of slackHookUrlList) {
await postToSlack(channelUrl, message);
}

spinner.succeed('Changelog published to Slack.');
}
}
}
Expand All @@ -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();
});
}

Expand Down
4 changes: 2 additions & 2 deletions bin/utils/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},

/**
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 898fb98

Please sign in to comment.