hyperlink the commit hash

Signed-off-by: mo <mcassidy@hchb.com>
This commit is contained in:
mo
2022-05-02 13:47:35 -05:00
parent 86e9497023
commit f786570c0e
3 changed files with 18 additions and 2 deletions
@@ -148,8 +148,11 @@ export class AzureDevOpsApi {
const linkBaseUrl = `${this.webApi.serverUrl}/${encodeURIComponent(
projectName,
)}/_git/${encodeURIComponent(repoName)}?version=GT`;
const commitBaseUrl = `${this.webApi.serverUrl}/${encodeURIComponent(
projectName,
)}/_git/${encodeURIComponent(repoName)}/commit`;
const gitTags: GitTag[] = tagRefs.map(tagRef => {
return mappedGitTag(tagRef, linkBaseUrl);
return mappedGitTag(tagRef, linkBaseUrl, commitBaseUrl);
});
return gitTags;
@@ -391,7 +394,11 @@ export function mappedRepoBuild(build: Build): RepoBuild {
};
}
export function mappedGitTag(gitRef: GitRef, linkBaseUrl: string): GitTag {
export function mappedGitTag(
gitRef: GitRef,
linkBaseUrl: string,
commitBaseUrl: string,
): GitTag {
return {
objectId: gitRef.objectId,
peeledObjectId: gitRef.peeledObjectId,
@@ -400,6 +407,9 @@ export function mappedGitTag(gitRef: GitRef, linkBaseUrl: string): GitTag {
link: `${linkBaseUrl}${encodeURIComponent(
gitRef.name?.replace('refs/tags/', '') ?? '',
)}`,
commitLink: `${commitBaseUrl}/${encodeURIComponent(
gitRef.peeledObjectId ?? '',
)}`,
};
}