fix: use payload.size for commit count (root cause)

This commit is contained in:
asepharyana
2026-07-03 05:25:41 +07:00
parent 9d88cefd60
commit 6be784298c
+5 -3
View File
@@ -75,14 +75,16 @@ function formatEvent(event) {
case "PushEvent": {
const branch = (event.payload?.ref || "").replace("refs/heads/", "");
const commits = event.payload?.commits || [];
const size = event.payload?.size || commits.length;
const msgs = commits
.slice(0, 3)
.map((c) => c.message?.split("\n")[0] || "no message")
.filter(Boolean);
if (commits.length > 0) {
return `• Push ${commits.length} commit${commits.length > 1 ? "s" : ""} ke \`${repo}\` (${branch}): ${msgs.join("; ")}`;
const countLabel = `${size} commit${size > 1 ? "s" : ""}`;
if (msgs.length > 0) {
return `• Push ${countLabel} ke \`${repo}\` (${branch}): ${msgs.join("; ")}`;
}
return `• Push ke \`${repo}\` (${branch})`;
return `• Push ${countLabel} ke \`${repo}\` (${branch})`;
}
case "CreateEvent": {
const refType = event.payload?.ref_type || "";