Skip to content

Commit b40798e

Browse files
Aditya JoshiAditya Joshi
authored andcommitted
refactor
1 parent 25ab7b1 commit b40798e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

commands/storybook.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,21 @@ async function storybook(serve, options) {
114114
}
115115

116116
let commit = await getLastCommit();
117-
let baseLine;
118-
if (process.env.BASELINE_BRANCH !== null && process.env.BASELINE_BRANCH !== undefined){
119-
if(process.env.BASELINE_BRANCH === ''){
117+
let baseLine = process.env.BASELINE_BRANCH;
118+
let currentBranch = process.env.CURRENT_BRANCH;
119+
if (baseLine !== null && baseLine !== undefined){
120+
if(baseLine === ''){
120121
const error = {
121122
"error": "MISSING_BRANCH_NAME",
122123
"message": "Error : The baseline branch name environment variable cannot be empty."
123124
};
124125
console.log(JSON.stringify(error, null, 2));
125126
process.exit(1);
126127
}
127-
baseLine = process.env.BASELINE_BRANCH
128128
}
129129

130-
console.log(`Baseline branch set to: ${baseLine}`)
131-
if(process.env.CURRENT_BRANCH !== null && process.env.CURRENT_BRANCH !==undefined){
132-
if(process.env.CURRENT_BRANCH === ''){
130+
if(currentBranch !== null && currentBranch !==undefined){
131+
if(currentBranch === ''){
133132
const error = {
134133
"error": "MISSING_BRANCH_NAME",
135134
"message": "Error : The current branch name environment variable cannot be empty."
@@ -150,8 +149,8 @@ async function storybook(serve, options) {
150149
customViewports: storybookConfig.customViewports
151150
},
152151
git: {
153-
branch: process.env.CURRENT_BRANCH || commit.branch|| '',
154-
baselineBranch: process.env.BASELINE_BRANCH || '',
152+
branch: currentBranch || commit.branch|| '',
153+
baselineBranch: baseLine || '',
155154
commitId: commit.shortHash,
156155
commitAuthor: commit.author.name,
157156
commitMessage: commit.subject,

0 commit comments

Comments
 (0)