Skip to content

Commit bd5fc94

Browse files
Aditya JoshiAditya Joshi
authored andcommitted
Minor change in setting baseline, earlier it was outside in the payload but need to set it inside git and other sanity checks for empty string values
1 parent 9efb286 commit bd5fc94

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

commands/storybook.js

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,29 @@ async function storybook(serve, options) {
115115

116116
let commit = await getLastCommit();
117117
let baseLine;
118-
if (process.env.BASELINE_BRANCH !== undefined && process.env.BASELINE_BRANCH !== null && process.env.BASELINE_BRANCH !== '')
119-
baseLine = process.env.BASELINE_BRANCH
120-
console.log(`Baseline branch set :${baseLine}`)
118+
if (process.env.BASELINE_BRANCH !== null && process.env.BASELINE_BRANCH !== undefined){
119+
if(process.env.BASELINE_BRANCH === ''){
120+
const error = {
121+
"error": "MISSING_BRANCH_NAME",
122+
"message": "Error : The baseline branch name environment variable cannot be empty."
123+
};
124+
console.log(JSON.stringify(error, null, 2));
125+
process.exit(1);
126+
}
127+
baseLine = process.env.BASELINE_BRANCH
128+
}
129+
130+
console.log(`Baseline branch set to: ${baseLine}`)
131+
if(process.env.CURRENT_BRANCH !== null && process.env.CURRENT_BRANCH !==undefined){
132+
if(process.env.BASELINE_BRANCH === ''){
133+
const error = {
134+
"error": "MISSING_BRANCH_NAME",
135+
"message": "Error : The current branch name environment variable cannot be empty."
136+
};
137+
console.log(JSON.stringify(error, null, 2));
138+
process.exit(1);
139+
}
140+
}
121141
let payload = {
122142
downloadURL: url.substring(url.search(/.com/)+5, url.search(/.zip/)+4),
123143
uploadId: uploadId,
@@ -135,10 +155,11 @@ async function storybook(serve, options) {
135155
commitAuthor: commit.author.name,
136156
commitMessage: commit.subject,
137157
githubURL: process.env.GITHUB_URL || '',
158+
baseline : baseLine ?? ""
138159
},
139160
buildName: buildName,
140-
baseline: baseLine?? "",
141161
}
162+
console.log(`Current branch set to: ${git.branch}`);
142163

143164
// Call static render API
144165
await axios.post(new URL(constants[options.env].STATIC_RENDER_PATH, constants[options.env].BASE_URL).href, payload)

0 commit comments

Comments
 (0)