fix: use payload.size for commit count (root cause)
This commit is contained in:
@@ -75,14 +75,16 @@ function formatEvent(event) {
|
|||||||
case "PushEvent": {
|
case "PushEvent": {
|
||||||
const branch = (event.payload?.ref || "").replace("refs/heads/", "");
|
const branch = (event.payload?.ref || "").replace("refs/heads/", "");
|
||||||
const commits = event.payload?.commits || [];
|
const commits = event.payload?.commits || [];
|
||||||
|
const size = event.payload?.size || commits.length;
|
||||||
const msgs = commits
|
const msgs = commits
|
||||||
.slice(0, 3)
|
.slice(0, 3)
|
||||||
.map((c) => c.message?.split("\n")[0] || "no message")
|
.map((c) => c.message?.split("\n")[0] || "no message")
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
if (commits.length > 0) {
|
const countLabel = `${size} commit${size > 1 ? "s" : ""}`;
|
||||||
return `• Push ${commits.length} commit${commits.length > 1 ? "s" : ""} ke \`${repo}\` (${branch}): ${msgs.join("; ")}`;
|
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": {
|
case "CreateEvent": {
|
||||||
const refType = event.payload?.ref_type || "";
|
const refType = event.payload?.ref_type || "";
|
||||||
|
|||||||
Reference in New Issue
Block a user