mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-22 16:11:29 +00:00
chore: auto-fix lint & formatting [skip ci]
This commit is contained in:
parent
3dce114cec
commit
17d10db845
11 changed files with 50 additions and 56 deletions
|
|
@ -96,12 +96,7 @@ export async function dispatchEvent(
|
|||
.map((a) =>
|
||||
a.ok
|
||||
? emojiPrefix("✅", true) +
|
||||
translate(
|
||||
"log.route_ok",
|
||||
{ route: a.routeName, target: a.target },
|
||||
undefined,
|
||||
tr,
|
||||
)
|
||||
translate("log.route_ok", { route: a.routeName, target: a.target }, undefined, tr)
|
||||
: emojiPrefix("❌", true) +
|
||||
translate(
|
||||
"log.route_fail",
|
||||
|
|
|
|||
|
|
@ -58,16 +58,12 @@ export function renderNeutralMessage(message: NeutralMessage): FormattedMessage
|
|||
url: message.author.url,
|
||||
}
|
||||
: undefined,
|
||||
fields: message.fields
|
||||
?.slice(0, MAX_FIELDS)
|
||||
.map((f) => ({
|
||||
name: cap(f.name, MAX_TITLE),
|
||||
value: cap(f.value, MAX_FIELD_VALUE),
|
||||
inline: f.inline,
|
||||
})),
|
||||
footer: footerText
|
||||
? { text: footerText, icon_url: message.forge?.iconUrl }
|
||||
: undefined,
|
||||
fields: message.fields?.slice(0, MAX_FIELDS).map((f) => ({
|
||||
name: cap(f.name, MAX_TITLE),
|
||||
value: cap(f.value, MAX_FIELD_VALUE),
|
||||
inline: f.inline,
|
||||
})),
|
||||
footer: footerText ? { text: footerText, icon_url: message.forge?.iconUrl } : undefined,
|
||||
timestamp: message.timestamp,
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -170,7 +170,11 @@ export function forgeInfo(event: WebhookEvent): NeutralForge | undefined {
|
|||
const repoUrl = (event.payload.repository as { html_url?: string } | undefined)?.html_url;
|
||||
switch (event.provider) {
|
||||
case "github":
|
||||
return { name: "GitHub", url: "https://github.com", iconUrl: "https://github.com/favicon.ico" };
|
||||
return {
|
||||
name: "GitHub",
|
||||
url: "https://github.com",
|
||||
iconUrl: "https://github.com/favicon.ico",
|
||||
};
|
||||
case "gitea": {
|
||||
if (!repoUrl) return undefined;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -64,8 +64,7 @@ export function formatPush(
|
|||
}
|
||||
if (created) {
|
||||
descriptionParts.push(
|
||||
em("🆕") +
|
||||
t(isTagPush ? "events.push.tag_created" : "events.push.branch_created"),
|
||||
em("🆕") + t(isTagPush ? "events.push.tag_created" : "events.push.branch_created"),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -77,8 +76,8 @@ export function formatPush(
|
|||
|
||||
const commitField = (c: (typeof commits)[number]): { name: string; value: string } => {
|
||||
const shortId = c.id?.slice(0, 7) ?? "???????";
|
||||
const msg = (c.message?.split("\n")[0] ?? "").slice(0, MAX_COMMIT_SUBJECT) ||
|
||||
t("common.no_message");
|
||||
const msg =
|
||||
(c.message?.split("\n")[0] ?? "").slice(0, MAX_COMMIT_SUBJECT) || t("common.no_message");
|
||||
const url = baseUrl && c.id ? `${baseUrl}/commit/${c.id}` : null;
|
||||
const hash = url ? `[\`${shortId}\`](${url})` : `\`${shortId}\``;
|
||||
return { name: `\u200b`, value: `${hash} ${msg}` };
|
||||
|
|
|
|||
|
|
@ -133,7 +133,8 @@ export function formatWorkflowRun(
|
|||
if (workflow.jobs?.length) {
|
||||
// Many-jobs workflows must stay under the Discord field value limit.
|
||||
const jobLines = workflow.jobs.map(
|
||||
(j) => `${em(WORKFLOW_CONCLUSION_EMOJI[j.conclusion ?? ""] ?? "⏳")}${cap(j.name ?? "", 200)}`,
|
||||
(j) =>
|
||||
`${em(WORKFLOW_CONCLUSION_EMOJI[j.conclusion ?? ""] ?? "⏳")}${cap(j.name ?? "", 200)}`,
|
||||
);
|
||||
fields.push({
|
||||
name: t("fields.job"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue