fix(formatters): localize PR buttons, cap oversized content, dedupe status logic

- PR merge/close button labels now follow the group language (actions.merge/close)
  instead of hardcoded Chinese
- clamp content to Discord embed limits (title 256, description 4096, field value
  1024, 25 fields) in formatters plus a render-layer safety net; Telegram gets a
  tag-safe 4096-char cap (capHtml closes dangling tags)
- raise commit subject truncation from 72 to 200 chars (MAX_COMMIT_SUBJECT)
- extract workflowStatus/workflowRunStatus/statusColorKey helpers shared by
  check_run/check_suite/workflow_run/workflow_job
- dedupe deployment ref/sha fields via addDeploymentRefFields
- commit_comment without a commit id uses title_plain (no dangling ???????)
- tag pushes now report 'Tag created'; zh push title includes the {ref}
- sender profile link derives from the repo's forge origin instead of github.com
- group webhook log emoji injected via emojiPrefix, removed from locale files
- dispatchEvent accepts preloaded groups (single KV read per webhook)
- webhook 401 logs distinguish 'secret not configured' from 'invalid signature'
This commit is contained in:
RhenCloud 2026-08-14 07:41:19 +08:00
parent e59b10f739
commit a5324fb0ea
No known key found for this signature in database
GPG key ID: A574A617378C4E0B
20 changed files with 425 additions and 136 deletions

View file

@ -38,6 +38,8 @@ export const en = {
appeared_in_branch: "Appeared in Branch",
reopened_by_user: "Reopened by User",
closed_by_user: "Closed by User",
merge: "Merge",
close: "Close",
},
fields: {
branch: "Branch",
@ -88,6 +90,7 @@ export const en = {
push: {
force_push: "**Force push**",
branch_created: "Branch created",
tag_created: "Tag created",
view_comparison: "[View comparison]({url})",
added: "+{count} added",
removed: "-{count} removed",
@ -154,6 +157,7 @@ export const en = {
commit_comment: {
action_comment: "{emoji}**{action}**",
title: "{repo}: Comment on commit {sha}",
title_plain: "{repo}: Comment on commit",
},
deployment: {
title: "{repo}: Deployment to `{env}` — {state}",
@ -201,7 +205,7 @@ export const en = {
title: "{repo}: {event}{action}",
routes: "Routes",
delivery: "Delivery",
route_ok: "{route} → {target}",
route_fail: "{route} → {target}: {error}",
route_ok: "{route} → {target}",
route_fail: "{route} → {target}: {error}",
},
};

View file

@ -38,6 +38,8 @@ export const zh = {
appeared_in_branch: "出现在分支中",
reopened_by_user: "用户重新打开",
closed_by_user: "用户关闭",
merge: "合并",
close: "关闭",
},
fields: {
branch: "分支",
@ -88,12 +90,13 @@ export const zh = {
push: {
force_push: "**强制推送**",
branch_created: "分支已创建",
tag_created: "标签已创建",
commits_pushed: "**{count}** 个提交已推送到 {ref}",
view_comparison: "[查看比较]({url})",
added: "+{count} 新增",
removed: "-{count} 删除",
modified: "~{count} 修改",
title: "{repo}: 推送了 {count} 个提交",
title: "{repo}: 推送了 {count} 个提交到 {ref}",
},
pr: {
action_pr: "{emoji}**{action}** 拉取请求",
@ -155,6 +158,7 @@ export const zh = {
commit_comment: {
action_comment: "{emoji}**{action}**",
title: "{repo}: 提交 {sha} 的评论",
title_plain: "{repo}: 提交评论",
},
deployment: {
title: "{repo}: 部署到 `{env}` — {state}",
@ -202,7 +206,7 @@ export const zh = {
title: "{repo}: {event}{action}",
routes: "路由",
delivery: "投递",
route_ok: "{route} → {target}",
route_fail: "{route} → {target}: {error}",
route_ok: "{route} → {target}",
route_fail: "{route} → {target}: {error}",
},
};