File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export function buildEnvStamp(mode: EnvStampMode) {
2828 console . info ( `BUILD_SCM_BRANCH ${ getCurrentBranch ( git ) } ` ) ;
2929 console . info ( `BUILD_SCM_COMMIT_SHA ${ getCurrentSha ( git ) } ` ) ;
3030 console . info ( `BUILD_SCM_HASH ${ getCurrentSha ( git ) } ` ) ;
31+ console . info ( `BUILD_SCM_ABBREV_HASH ${ getCurrentAbbrevSha ( git ) } ` ) ;
3132 console . info ( `BUILD_SCM_BRANCH ${ getCurrentBranchOrRevision ( git ) } ` ) ;
3233 console . info ( `BUILD_SCM_LOCAL_CHANGES ${ hasLocalChanges ( git ) } ` ) ;
3334 console . info ( `BUILD_SCM_USER ${ getCurrentGitUser ( git ) } ` ) ;
@@ -99,6 +100,15 @@ function getCurrentSha(git: GitClient) {
99100 }
100101}
101102
103+ /** Get the current abbreviated SHA of HEAD. */
104+ function getCurrentAbbrevSha ( git : GitClient ) {
105+ try {
106+ return git . run ( [ 'rev-parse' , '--short' , 'HEAD' ] ) . stdout . trim ( ) ;
107+ } catch {
108+ return '' ;
109+ }
110+ }
111+
102112/** Get the current branch or revision of HEAD. */
103113function getCurrentBranchOrRevision ( git : GitClient ) {
104114 try {
You can’t perform that action at this time.
0 commit comments