mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
fix(formatter): strip only leading ref prefixes
A short branch or tag may itself contain refs/heads or refs/tags. Strip one leading full-ref prefix at the caller and keep short names unchanged when generating labels and links.
This commit is contained in:
1 parent
e44fc60c55
commit
aca870374f
3 files changed
+32
-12
No files matched your search
@@ -8,6 +8,7 @@ import {
|
||||
type T,
|
||||
buildMessage,
|
||||
repoBaseUrl,
|
||||
shortRef,
|
||||
} from "./helpers";
|
||||
|
||||
/** Shared "branch/tag + commit" fields for deployment events. */
|
||||
@@ -21,7 +22,10 @@ function addDeploymentRefFields(
|
||||
const isTag = deployment.ref.startsWith("refs/tags/");
|
||||
fields.push({
|
||||
name: t("fields.branch_tag"),
|
||||
value: isTag ? tagLink(baseUrl, deployment.ref) : branchLink(baseUrl, deployment.ref),
|
||||
// A deployment's ref may be a full ref: its one leading prefix goes.
|
||||
value: isTag
|
||||
? tagLink(baseUrl, shortRef(deployment.ref))
|
||||
: branchLink(baseUrl, shortRef(deployment.ref)),
|
||||
inline: true,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user