Skip to content

Commit e2b8d13

Browse files
authored
fix: defines proper exit codes to properly fail on GitHub actions (#45)
1 parent 02dc427 commit e2b8d13

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

bin/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async function checkHeadBranch(repoOwner, releaseRepo) {
8585
const headBranch = await flow.fetchHeadBranch(repoOwner, releaseRepo);
8686
if (headBranch == null) {
8787
console.log(kleur.red("Head branch can not be found! The release has been interrupted!"));
88-
process.exit(0);
88+
process.exit(1);
8989
}
9090
return headBranch;
9191
}
@@ -94,7 +94,7 @@ function checkDirectory() {
9494
// check if the current directory is git repo
9595
if (options.repo == undefined && !helper.isGitRepo()) {
9696
console.log(`The directory '${helper.retrieveCurrentDirectory()}' is not a Git repo.`);
97-
process.exit(0);
97+
process.exit(1);
9898
}
9999
}
100100

bin/utils/flow.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function checkRequiredEnvVariables() {
1919
spinner.start('Checking required ENV variables...');
2020
if (helper.requiredEnvVariablesExist() == false) {
2121
spinner.fail('The required env variables are not set in order to run the command.');
22-
process.exit(0);
22+
process.exit(1);
2323
}
2424
spinner.succeed('Required ENV variables in place.');
2525
}
@@ -35,7 +35,7 @@ export async function checkInternetConnection() {
3535
const isInternetUp = await isOnline();
3636
if (!isInternetUp) {
3737
spinner.fail('There is no internet connection!');
38-
process.exit(0);
38+
process.exit(1);
3939
}
4040
spinner.succeed('Internet connection established.');
4141
}
@@ -133,7 +133,7 @@ export async function prepareChangelog(owner, repo, base, head) {
133133
} catch (error) {
134134
const errorResponseData = error.response.data;
135135
spinner.fail(`Something went wrong while preparing the changelog! ${errorResponseData.message} -> ${errorResponseData.documentation_url}`);
136-
process.exit(0);
136+
process.exit(1);
137137
}
138138
}
139139

@@ -197,7 +197,7 @@ export async function createRelease(owner, repo, draft, name, body, tag_name) {
197197
errorMessage += `\t* field: '${element.field}' - code: '${element.code}'`;
198198
});
199199
spinner.fail(`${message} while preparing the release! ${errorMessage}`);
200-
process.exit(0);
200+
process.exit(1);
201201
}
202202
}
203203

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "yaba-release-cli",
3-
"version": "1.7.6",
3+
"version": "1.7.7",
44
"description": "Yaba is a simple CLI tool that helps you manage releases of your Github projects.",
55
"main": "bin/index.js",
66
"type": "module",

0 commit comments

Comments
 (0)