@@ -27,16 +27,27 @@ export function isGitRepo(): boolean {
2727}
2828
2929export default ( ctx : Context ) : Git => {
30+ if ( ctx . env . SMART_GIT ) {
31+ ctx . env . BASELINE_BRANCH = ''
32+ if ( ctx . options . baselineBranch !== '' ) {
33+ ctx . env . SMART_GIT = false
34+ }
35+ }
3036 if ( ctx . env . SMARTUI_GIT_INFO_FILEPATH ) {
3137 let gitInfo = JSON . parse ( fs . readFileSync ( ctx . env . SMARTUI_GIT_INFO_FILEPATH , 'utf-8' ) ) ;
3238
39+ if ( ctx . options . markBaseline ) {
40+ ctx . env . BASELINE_BRANCH = ctx . env . CURRENT_BRANCH || gitInfo . branch || ''
41+ ctx . env . SMART_GIT = false
42+ }
43+
3344 return {
3445 branch : ctx . env . CURRENT_BRANCH || gitInfo . branch || '' ,
3546 commitId : gitInfo . commit_id . slice ( 0 , 6 ) || '' ,
3647 commitMessage : gitInfo . commit_body || '' ,
3748 commitAuthor : gitInfo . commit_author || '' ,
3849 githubURL : ( ctx . env . GITHUB_ACTIONS ) ? `${ constants . GITHUB_API_HOST } /repos/${ process . env . GITHUB_REPOSITORY } /statuses/${ gitInfo . commit_id } ` : '' ,
39- baselineBranch : ctx . env . BASELINE_BRANCH || ''
50+ baselineBranch : ctx . options . baselineBranch || ctx . env . BASELINE_BRANCH || ''
4051 }
4152 } else {
4253 const splitCharacter = '<##>' ;
@@ -52,13 +63,18 @@ export default (ctx: Context): Git => {
5263 var branch = ctx . env . CURRENT_BRANCH || branchAndTags [ 0 ] ;
5364 var tags = branchAndTags . slice ( 1 ) ;
5465
66+ if ( ctx . options . markBaseline ) {
67+ ctx . env . BASELINE_BRANCH = branch || ''
68+ ctx . env . SMART_GIT = false
69+ }
70+
5571 return {
5672 branch : branch || '' ,
5773 commitId : res [ 0 ] || '' ,
5874 commitMessage : res [ 2 ] || '' ,
5975 commitAuthor : res [ 7 ] || '' ,
6076 githubURL : ( ctx . env . GITHUB_ACTIONS ) ? `${ constants . GITHUB_API_HOST } /repos/${ process . env . GITHUB_REPOSITORY } /statuses/${ res [ 1 ] } ` : '' ,
61- baselineBranch : ctx . env . BASELINE_BRANCH || ''
77+ baselineBranch : ctx . options . baselineBranch || ctx . env . BASELINE_BRANCH || ''
6278 } ;
6379 }
6480}
0 commit comments