[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot]
2025-09-23 16:46:21 +00:00
committed by GitHub
parent b4a3cbdff4
commit cd06b55a0c
6 changed files with 169 additions and 163 deletions
@@ -50,7 +50,8 @@ export const sendBuildErrorNotifications = async ({
}); });
for (const notification of notificationList) { for (const notification of notificationList) {
const { email, discord, telegram, slack, gotify, ntfy, lark } = notification; const { email, discord, telegram, slack, gotify, ntfy, lark } =
notification;
if (email) { if (email) {
const template = await renderAsync( const template = await renderAsync(
BuildFailedEmail({ BuildFailedEmail({
@@ -128,11 +129,11 @@ export const sendBuildErrorNotifications = async ({
gotify, gotify,
decorate("⚠️", "Build Failed"), decorate("⚠️", "Build Failed"),
`${decorate("🛠️", `Project: ${projectName}`)}` + `${decorate("🛠️", `Project: ${projectName}`)}` +
`${decorate("⚙️", `Application: ${applicationName}`)}` + `${decorate("⚙️", `Application: ${applicationName}`)}` +
`${decorate("❔", `Type: ${applicationType}`)}` + `${decorate("❔", `Type: ${applicationType}`)}` +
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}` + `${decorate("🕒", `Date: ${date.toLocaleString()}`)}` +
`${decorate("⚠️", `Error:\n${errorMessage}`)}` + `${decorate("⚠️", `Error:\n${errorMessage}`)}` +
`${decorate("🔗", `Build details:\n${buildLink}`)}`, `${decorate("🔗", `Build details:\n${buildLink}`)}`,
); );
} }
@@ -143,10 +144,10 @@ export const sendBuildErrorNotifications = async ({
"warning", "warning",
`view, Build details, ${buildLink}, clear=true;`, `view, Build details, ${buildLink}, clear=true;`,
`🛠️Project: ${projectName}\n` + `🛠️Project: ${projectName}\n` +
`⚙️Application: ${applicationName}\n` + `⚙️Application: ${applicationName}\n` +
`❔Type: ${applicationType}\n` + `❔Type: ${applicationType}\n` +
`🕒Date: ${date.toLocaleString()}\n` + `🕒Date: ${date.toLocaleString()}\n` +
`⚠️Error:\n${errorMessage}`, `⚠️Error:\n${errorMessage}`,
); );
} }
@@ -228,10 +229,10 @@ export const sendBuildErrorNotifications = async ({
normal_v2: { normal_v2: {
default: "normal", default: "normal",
pc: "normal", pc: "normal",
mobile: "heading" mobile: "heading",
} },
} },
} },
}, },
header: { header: {
title: { title: {
@@ -243,7 +244,7 @@ export const sendBuildErrorNotifications = async ({
content: "", content: "",
}, },
template: "red", template: "red",
padding: "12px 12px 12px 12px" padding: "12px 12px 12px 12px",
}, },
body: { body: {
direction: "vertical", direction: "vertical",
@@ -260,23 +261,23 @@ export const sendBuildErrorNotifications = async ({
tag: "markdown", tag: "markdown",
content: `**Project:**\n${projectName}`, content: `**Project:**\n${projectName}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Type:**\n${applicationType}`, content: `**Type:**\n${applicationType}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Error Message:**\n\`\`\`\n${truncatedErrorMessage}\n\`\`\``, content: `**Error Message:**\n\`\`\`\n${truncatedErrorMessage}\n\`\`\``,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
], ],
vertical_align: "top", vertical_align: "top",
weight: 1 weight: 1,
}, },
{ {
tag: "column", tag: "column",
@@ -286,19 +287,19 @@ export const sendBuildErrorNotifications = async ({
tag: "markdown", tag: "markdown",
content: `**Application:**\n${applicationName}`, content: `**Application:**\n${applicationName}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Date:**\n${format(date, "PP pp")}`, content: `**Date:**\n${format(date, "PP pp")}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
], ],
vertical_align: "top", vertical_align: "top",
weight: 1 weight: 1,
} },
] ],
}, },
{ {
tag: "button", tag: "button",
@@ -315,13 +316,13 @@ export const sendBuildErrorNotifications = async ({
default_url: buildLink, default_url: buildLink,
pc_url: "", pc_url: "",
ios_url: "", ios_url: "",
android_url: "" android_url: "",
} },
], ],
margin: "0px 0px 0px 0px" margin: "0px 0px 0px 0px",
} },
], ],
} },
}, },
}); });
} }
@@ -51,7 +51,8 @@ export const sendBuildSuccessNotifications = async ({
}); });
for (const notification of notificationList) { for (const notification of notificationList) {
const { email, discord, telegram, slack, gotify, ntfy, lark } = notification; const { email, discord, telegram, slack, gotify, ntfy, lark } =
notification;
if (email) { if (email) {
const template = await renderAsync( const template = await renderAsync(
@@ -123,10 +124,10 @@ export const sendBuildSuccessNotifications = async ({
gotify, gotify,
decorate("✅", "Build Success"), decorate("✅", "Build Success"),
`${decorate("🛠️", `Project: ${projectName}`)}` + `${decorate("🛠️", `Project: ${projectName}`)}` +
`${decorate("⚙️", `Application: ${applicationName}`)}` + `${decorate("⚙️", `Application: ${applicationName}`)}` +
`${decorate("❔", `Type: ${applicationType}`)}` + `${decorate("❔", `Type: ${applicationType}`)}` +
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}` + `${decorate("🕒", `Date: ${date.toLocaleString()}`)}` +
`${decorate("🔗", `Build details:\n${buildLink}`)}`, `${decorate("🔗", `Build details:\n${buildLink}`)}`,
); );
} }
@@ -137,9 +138,9 @@ export const sendBuildSuccessNotifications = async ({
"white_check_mark", "white_check_mark",
`view, Build details, ${buildLink}, clear=true;`, `view, Build details, ${buildLink}, clear=true;`,
`🛠Project: ${projectName}\n` + `🛠Project: ${projectName}\n` +
`⚙️Application: ${applicationName}\n` + `⚙️Application: ${applicationName}\n` +
`❔Type: ${applicationType}\n` + `❔Type: ${applicationType}\n` +
`🕒Date: ${date.toLocaleString()}`, `🕒Date: ${date.toLocaleString()}`,
); );
} }
@@ -225,10 +226,10 @@ export const sendBuildSuccessNotifications = async ({
normal_v2: { normal_v2: {
default: "normal", default: "normal",
pc: "normal", pc: "normal",
mobile: "heading" mobile: "heading",
} },
} },
} },
}, },
header: { header: {
title: { title: {
@@ -240,7 +241,7 @@ export const sendBuildSuccessNotifications = async ({
content: "", content: "",
}, },
template: "green", template: "green",
padding: "12px 12px 12px 12px" padding: "12px 12px 12px 12px",
}, },
body: { body: {
direction: "vertical", direction: "vertical",
@@ -257,17 +258,17 @@ export const sendBuildSuccessNotifications = async ({
tag: "markdown", tag: "markdown",
content: `**Project:**\n${projectName}`, content: `**Project:**\n${projectName}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Type:**\n${applicationType}`, content: `**Type:**\n${applicationType}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
], ],
vertical_align: "top", vertical_align: "top",
weight: 1 weight: 1,
}, },
{ {
tag: "column", tag: "column",
@@ -277,19 +278,19 @@ export const sendBuildSuccessNotifications = async ({
tag: "markdown", tag: "markdown",
content: `**Application:**\n${applicationName}`, content: `**Application:**\n${applicationName}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Date:**\n${format(date, "PP pp")}`, content: `**Date:**\n${format(date, "PP pp")}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
], ],
vertical_align: "top", vertical_align: "top",
weight: 1 weight: 1,
} },
] ],
}, },
{ {
tag: "button", tag: "button",
@@ -306,13 +307,13 @@ export const sendBuildSuccessNotifications = async ({
default_url: buildLink, default_url: buildLink,
pc_url: "", pc_url: "",
ios_url: "", ios_url: "",
android_url: "" android_url: "",
} },
], ],
margin: "0px 0px 0px 0px" margin: "0px 0px 0px 0px",
} },
], ],
} },
}, },
}); });
} }
@@ -50,7 +50,8 @@ export const sendDatabaseBackupNotifications = async ({
}); });
for (const notification of notificationList) { for (const notification of notificationList) {
const { email, discord, telegram, slack, gotify, ntfy, lark } = notification; const { email, discord, telegram, slack, gotify, ntfy, lark } =
notification;
if (email) { if (email) {
const template = await renderAsync( const template = await renderAsync(
@@ -120,11 +121,11 @@ export const sendDatabaseBackupNotifications = async ({
}, },
...(type === "error" && errorMessage ...(type === "error" && errorMessage
? [ ? [
{ {
name: decorate("`⚠️`", "Error Message"), name: decorate("`⚠️`", "Error Message"),
value: `\`\`\`${errorMessage}\`\`\``, value: `\`\`\`${errorMessage}\`\`\``,
}, },
] ]
: []), : []),
], ],
timestamp: date.toISOString(), timestamp: date.toISOString(),
@@ -145,11 +146,11 @@ export const sendDatabaseBackupNotifications = async ({
`Database Backup ${type === "success" ? "Successful" : "Failed"}`, `Database Backup ${type === "success" ? "Successful" : "Failed"}`,
), ),
`${decorate("🛠️", `Project: ${projectName}`)}` + `${decorate("🛠️", `Project: ${projectName}`)}` +
`${decorate("⚙️", `Application: ${applicationName}`)}` + `${decorate("⚙️", `Application: ${applicationName}`)}` +
`${decorate("❔", `Type: ${databaseType}`)}` + `${decorate("❔", `Type: ${databaseType}`)}` +
`${decorate("📂", `Database Name: ${databaseName}`)}` + `${decorate("📂", `Database Name: ${databaseName}`)}` +
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}` + `${decorate("🕒", `Date: ${date.toLocaleString()}`)}` +
`${type === "error" && errorMessage ? decorate("❌", `Error:\n${errorMessage}`) : ""}`, `${type === "error" && errorMessage ? decorate("❌", `Error:\n${errorMessage}`) : ""}`,
); );
} }
@@ -160,11 +161,11 @@ export const sendDatabaseBackupNotifications = async ({
`${type === "success" ? "white_check_mark" : "x"}`, `${type === "success" ? "white_check_mark" : "x"}`,
"", "",
`🛠Project: ${projectName}\n` + `🛠Project: ${projectName}\n` +
`⚙️Application: ${applicationName}\n` + `⚙️Application: ${applicationName}\n` +
`❔Type: ${databaseType}\n` + `❔Type: ${databaseType}\n` +
`📂Database Name: ${databaseName}` + `📂Database Name: ${databaseName}` +
`🕒Date: ${date.toLocaleString()}\n` + `🕒Date: ${date.toLocaleString()}\n` +
`${type === "error" && errorMessage ? `❌Error:\n${errorMessage}` : ""}`, `${type === "error" && errorMessage ? `❌Error:\n${errorMessage}` : ""}`,
); );
} }
@@ -196,12 +197,12 @@ export const sendDatabaseBackupNotifications = async ({
fields: [ fields: [
...(type === "error" && errorMessage ...(type === "error" && errorMessage
? [ ? [
{ {
title: "Error Message", title: "Error Message",
value: errorMessage, value: errorMessage,
short: false, short: false,
}, },
] ]
: []), : []),
{ {
title: "Project", title: "Project",
@@ -243,9 +244,10 @@ export const sendDatabaseBackupNotifications = async ({
if (lark) { if (lark) {
const limitCharacter = 800; const limitCharacter = 800;
const truncatedErrorMessage = errorMessage && errorMessage.length > limitCharacter const truncatedErrorMessage =
? errorMessage.substring(0, limitCharacter) errorMessage && errorMessage.length > limitCharacter
: errorMessage; ? errorMessage.substring(0, limitCharacter)
: errorMessage;
await sendLarkNotification(lark, { await sendLarkNotification(lark, {
msg_type: "interactive", msg_type: "interactive",
@@ -258,10 +260,10 @@ export const sendDatabaseBackupNotifications = async ({
normal_v2: { normal_v2: {
default: "normal", default: "normal",
pc: "normal", pc: "normal",
mobile: "heading" mobile: "heading",
} },
} },
} },
}, },
header: { header: {
title: { title: {
@@ -276,7 +278,7 @@ export const sendDatabaseBackupNotifications = async ({
content: "", content: "",
}, },
template: type === "success" ? "green" : "red", template: type === "success" ? "green" : "red",
padding: "12px 12px 12px 12px" padding: "12px 12px 12px 12px",
}, },
body: { body: {
direction: "vertical", direction: "vertical",
@@ -293,23 +295,23 @@ export const sendDatabaseBackupNotifications = async ({
tag: "markdown", tag: "markdown",
content: `**Project:**\n${projectName}`, content: `**Project:**\n${projectName}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Database Type:**\n${databaseType}`, content: `**Database Type:**\n${databaseType}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Status:**\n${type === "success" ? "Successful" : "Failed"}`, content: `**Status:**\n${type === "success" ? "Successful" : "Failed"}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
], ],
vertical_align: "top", vertical_align: "top",
weight: 1 weight: 1,
}, },
{ {
tag: "column", tag: "column",
@@ -319,38 +321,38 @@ export const sendDatabaseBackupNotifications = async ({
tag: "markdown", tag: "markdown",
content: `**Application:**\n${applicationName}`, content: `**Application:**\n${applicationName}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Database Name:**\n${databaseName}`, content: `**Database Name:**\n${databaseName}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Date:**\n${format(date, "PP pp")}`, content: `**Date:**\n${format(date, "PP pp")}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
], ],
vertical_align: "top", vertical_align: "top",
weight: 1 weight: 1,
} },
] ],
}, },
...(type === "error" && truncatedErrorMessage ...(type === "error" && truncatedErrorMessage
? [ ? [
{ {
tag: "markdown", tag: "markdown",
content: `**Error Message:**\n\`\`\`\n${truncatedErrorMessage}\n\`\`\``, content: `**Error Message:**\n\`\`\`\n${truncatedErrorMessage}\n\`\`\``,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
] ]
: []) : []),
], ],
} },
}, },
}); });
} }
@@ -37,7 +37,8 @@ export const sendDockerCleanupNotifications = async (
}); });
for (const notification of notificationList) { for (const notification of notificationList) {
const { email, discord, telegram, slack, gotify, ntfy, lark } = notification; const { email, discord, telegram, slack, gotify, ntfy, lark } =
notification;
if (email) { if (email) {
const template = await renderAsync( const template = await renderAsync(
@@ -93,7 +94,7 @@ export const sendDockerCleanupNotifications = async (
gotify, gotify,
decorate("✅", "Docker Cleanup"), decorate("✅", "Docker Cleanup"),
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}` + `${decorate("🕒", `Date: ${date.toLocaleString()}`)}` +
`${decorate("📜", `Message:\n${message}`)}`, `${decorate("📜", `Message:\n${message}`)}`,
); );
} }
@@ -150,10 +151,10 @@ export const sendDockerCleanupNotifications = async (
normal_v2: { normal_v2: {
default: "normal", default: "normal",
pc: "normal", pc: "normal",
mobile: "heading" mobile: "heading",
} },
} },
} },
}, },
header: { header: {
title: { title: {
@@ -165,7 +166,7 @@ export const sendDockerCleanupNotifications = async (
content: "", content: "",
}, },
template: "green", template: "green",
padding: "12px 12px 12px 12px" padding: "12px 12px 12px 12px",
}, },
body: { body: {
direction: "vertical", direction: "vertical",
@@ -182,17 +183,17 @@ export const sendDockerCleanupNotifications = async (
tag: "markdown", tag: "markdown",
content: `**Status:**\nSuccessful`, content: `**Status:**\nSuccessful`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Cleanup Details:**\n${message}`, content: `**Cleanup Details:**\n${message}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
], ],
vertical_align: "top", vertical_align: "top",
weight: 1 weight: 1,
}, },
{ {
tag: "column", tag: "column",
@@ -202,16 +203,16 @@ export const sendDockerCleanupNotifications = async (
tag: "markdown", tag: "markdown",
content: `**Date:**\n${format(date, "PP pp")}`, content: `**Date:**\n${format(date, "PP pp")}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
], ],
vertical_align: "top", vertical_align: "top",
weight: 1 weight: 1,
} },
] ],
} },
], ],
} },
}, },
}); });
} }
@@ -31,7 +31,8 @@ export const sendDokployRestartNotifications = async () => {
}); });
for (const notification of notificationList) { for (const notification of notificationList) {
const { email, discord, telegram, slack, gotify, ntfy, lark } = notification; const { email, discord, telegram, slack, gotify, ntfy, lark } =
notification;
if (email) { if (email) {
const template = await renderAsync( const template = await renderAsync(
@@ -151,10 +152,10 @@ export const sendDokployRestartNotifications = async () => {
normal_v2: { normal_v2: {
default: "normal", default: "normal",
pc: "normal", pc: "normal",
mobile: "heading" mobile: "heading",
} },
} },
} },
}, },
header: { header: {
title: { title: {
@@ -166,7 +167,7 @@ export const sendDokployRestartNotifications = async () => {
content: "", content: "",
}, },
template: "green", template: "green",
padding: "12px 12px 12px 12px" padding: "12px 12px 12px 12px",
}, },
body: { body: {
direction: "vertical", direction: "vertical",
@@ -183,11 +184,11 @@ export const sendDokployRestartNotifications = async () => {
tag: "markdown", tag: "markdown",
content: `**Status:**\nSuccessful`, content: `**Status:**\nSuccessful`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
], ],
vertical_align: "top", vertical_align: "top",
weight: 1 weight: 1,
}, },
{ {
tag: "column", tag: "column",
@@ -197,16 +198,16 @@ export const sendDokployRestartNotifications = async () => {
tag: "markdown", tag: "markdown",
content: `**Restart Time:**\n${format(date, "PP pp")}`, content: `**Restart Time:**\n${format(date, "PP pp")}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
], ],
vertical_align: "top", vertical_align: "top",
weight: 1 weight: 1,
} },
] ],
} },
], ],
} },
}, },
}); });
} catch (error) { } catch (error) {
@@ -166,10 +166,10 @@ export const sendServerThresholdNotifications = async (
normal_v2: { normal_v2: {
default: "normal", default: "normal",
pc: "normal", pc: "normal",
mobile: "heading" mobile: "heading",
} },
} },
} },
}, },
header: { header: {
title: { title: {
@@ -181,7 +181,7 @@ export const sendServerThresholdNotifications = async (
content: "", content: "",
}, },
template: "red", template: "red",
padding: "12px 12px 12px 12px" padding: "12px 12px 12px 12px",
}, },
body: { body: {
direction: "vertical", direction: "vertical",
@@ -198,23 +198,23 @@ export const sendServerThresholdNotifications = async (
tag: "markdown", tag: "markdown",
content: `**Server Name:**\n${payload.ServerName}`, content: `**Server Name:**\n${payload.ServerName}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Current Value:**\n${payload.Value.toFixed(2)}%`, content: `**Current Value:**\n${payload.Value.toFixed(2)}%`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Alert Message:**\n${payload.Message}`, content: `**Alert Message:**\n${payload.Message}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
], ],
vertical_align: "top", vertical_align: "top",
weight: 1 weight: 1,
}, },
{ {
tag: "column", tag: "column",
@@ -224,28 +224,28 @@ export const sendServerThresholdNotifications = async (
tag: "markdown", tag: "markdown",
content: `**Type:**\n${payload.Type === "CPU" ? "🔲" : "💾"} ${payload.Type}`, content: `**Type:**\n${payload.Type === "CPU" ? "🔲" : "💾"} ${payload.Type}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Threshold:**\n${payload.Threshold.toFixed(2)}%`, content: `**Threshold:**\n${payload.Threshold.toFixed(2)}%`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
}, },
{ {
tag: "markdown", tag: "markdown",
content: `**Alert Time:**\n${date.toLocaleString()}`, content: `**Alert Time:**\n${date.toLocaleString()}`,
text_align: "left", text_align: "left",
text_size: "normal_v2" text_size: "normal_v2",
} },
], ],
vertical_align: "top", vertical_align: "top",
weight: 1 weight: 1,
} },
] ],
} },
], ],
} },
}, },
}); });
} }