@@ -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 ( / .c o m / ) + 5 , url . search ( / .z i p / ) + 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