diff --git a/ng-dev/release/stamping/env-stamp.ts b/ng-dev/release/stamping/env-stamp.ts index 38cd37233..47ee99271 100644 --- a/ng-dev/release/stamping/env-stamp.ts +++ b/ng-dev/release/stamping/env-stamp.ts @@ -28,6 +28,7 @@ export function buildEnvStamp(mode: EnvStampMode) { console.info(`BUILD_SCM_BRANCH ${getCurrentBranch(git)}`); console.info(`BUILD_SCM_COMMIT_SHA ${getCurrentSha(git)}`); console.info(`BUILD_SCM_HASH ${getCurrentSha(git)}`); + console.info(`BUILD_SCM_ABBREV_HASH ${getCurrentAbbrevSha(git)}`); console.info(`BUILD_SCM_BRANCH ${getCurrentBranchOrRevision(git)}`); console.info(`BUILD_SCM_LOCAL_CHANGES ${hasLocalChanges(git)}`); console.info(`BUILD_SCM_USER ${getCurrentGitUser(git)}`); @@ -99,6 +100,15 @@ function getCurrentSha(git: GitClient) { } } +/** Get the current abbreviated SHA of HEAD. */ +function getCurrentAbbrevSha(git: GitClient) { + try { + return git.run(['rev-parse', '--short', 'HEAD']).stdout.trim(); + } catch { + return ''; + } +} + /** Get the current branch or revision of HEAD. */ function getCurrentBranchOrRevision(git: GitClient) { try {