豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit c922f5b

Browse files
kormidejosephperrott
authored andcommitted
feat(ng-dev): abbreviated SHA stamp (#373)
PR Close #373
1 parent 2f41657 commit c922f5b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ng-dev/release/stamping/env-stamp.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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. */
103113
function getCurrentBranchOrRevision(git: GitClient) {
104114
try {

0 commit comments

Comments
 (0)