mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-22 16:11:29 +00:00
fix(formatters): dedupe push count line, link workflow run name to actions
This commit is contained in:
parent
dfb65ef70d
commit
cf65111e4e
5 changed files with 16 additions and 18 deletions
|
|
@ -58,14 +58,6 @@ export function formatPush(
|
|||
descriptionParts.push(em("🆕") + t("events.push.branch_created"));
|
||||
}
|
||||
|
||||
descriptionParts.push(
|
||||
t("events.push.commits_pushed", {
|
||||
count,
|
||||
s: count !== 1 ? "s" : "",
|
||||
ref: isTagPush ? tagLink(baseUrl, rawRef, ref) : branchLink(baseUrl, rawRef, ref),
|
||||
}),
|
||||
);
|
||||
|
||||
if (compareUrl) {
|
||||
descriptionParts.push(t("events.push.view_comparison", { url: compareUrl }));
|
||||
}
|
||||
|
|
@ -119,6 +111,7 @@ export function formatPush(
|
|||
count,
|
||||
s: count !== 1 ? "s" : "",
|
||||
repo: repo ?? t("common.repository"),
|
||||
ref: isTagPush ? tagLink(baseUrl, rawRef, ref) : branchLink(baseUrl, rawRef, ref),
|
||||
}),
|
||||
url: compareUrl,
|
||||
color: GITHUB_COLORS.push,
|
||||
|
|
|
|||
|
|
@ -175,13 +175,16 @@ export function formatWorkflowRun(
|
|||
});
|
||||
}
|
||||
|
||||
const runLabel = workflow.html_url
|
||||
? `[${workflow.name ?? "Workflow"} — ${status}](${workflow.html_url})`
|
||||
: `${workflow.name ?? "Workflow"} — ${status}`;
|
||||
|
||||
return buildMessage(
|
||||
{
|
||||
author,
|
||||
title: t("events.workflow_run.title", {
|
||||
repo: repo ?? t("common.repository"),
|
||||
name: workflow.name ?? "Workflow",
|
||||
conclusion: status,
|
||||
run: runLabel,
|
||||
}),
|
||||
url: workflow.html_url,
|
||||
color: GITHUB_COLORS[colorKey],
|
||||
|
|
|
|||
|
|
@ -88,12 +88,11 @@ export const en = {
|
|||
push: {
|
||||
force_push: "**Force push**",
|
||||
branch_created: "Branch created",
|
||||
commits_pushed: "**{count}** commit{s} pushed to {ref}",
|
||||
view_comparison: "[View comparison]({url})",
|
||||
added: "+{count} added",
|
||||
removed: "-{count} removed",
|
||||
modified: "~{count} modified",
|
||||
title: "{repo}: Pushed {count} commit{s}",
|
||||
title: "{repo}: Pushed {count} commit{s} to {ref}",
|
||||
},
|
||||
pr: {
|
||||
action_pr: "{emoji}**{action}** pull request",
|
||||
|
|
@ -108,7 +107,7 @@ export const en = {
|
|||
action_comment: "{emoji}**{action}** comment",
|
||||
},
|
||||
workflow_run: {
|
||||
title: "{repo}: {name} — {conclusion}",
|
||||
title: "{repo}: {run}",
|
||||
},
|
||||
workflow_job: {
|
||||
title: "{repo}: Job {name} — {conclusion}",
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ export const zh = {
|
|||
action_comment: "{emoji}**{action}** 评论",
|
||||
},
|
||||
workflow_run: {
|
||||
title: "{repo}: {name} — {conclusion}",
|
||||
title: "{repo}: {run}",
|
||||
},
|
||||
workflow_job: {
|
||||
title: "{repo}: 作业 {name} — {conclusion}",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue