perf: 优化钉钉通知标题颜色

pull/409/head
xiaojunnuo 2025-05-17 01:13:36 +08:00
parent a818a3d293
commit a560999d13
2 changed files with 7 additions and 5 deletions

View File

@ -218,7 +218,7 @@ export class Executor {
returnType: ResultType.error,
runnable: t,
});
errorMessage += `任务${t.title}执行失败,错误详情:${e.message}`;
errorMessage += `任务${t.title}执行失败,错误详情${e.message}`;
}
}
if (errorList.length > 0) {
@ -438,7 +438,7 @@ export class Executor {
const runnableError = error as RunnableError;
content = `流水线ID:${this.pipeline.id}运行ID:${this.runtime.id}\n\n`;
for (const re of runnableError.errors) {
content += ` - ${re.runnable.title} 执行失败,错误详情:${re.e?.error?.message}\n\n`;
content += ` - ${re.runnable.title} 执行失败,错误详情${re.e?.error?.message}\n\n`;
}
} else {
content = `流水线ID:${this.pipeline.id}运行ID:${this.runtime.id}\n\n${this.currentStatusMap?.currentStep?.title} 执行失败\n\n错误详情:${error.message}`;

View File

@ -125,15 +125,17 @@ export class DingTalkNotification extends BaseNotification {
at.isAtAll = true;
}
const color = body.errorMessage?'red':'green';
const res = await this.http.request({
url: webhook,
method: 'POST',
data: {
at: at,
text: {
content: `${body.title}\n${body.content}\n查看详情: ${body.url}`,
markdown: {
title: body.title,
text: `<font color='${color}'>${body.title}</font>\n\n\n ${body.content}\n\n\n[查看详情](${body.url})`,
},
msgtype:"text"
msgtype:"markdown"
},
});
if(res.errcode>100){