mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
fix(push): render git push branch deletions as a delete message
This commit is contained in:
2 files changed
+44
No files matched your search
@@ -25,8 +25,30 @@ export function formatPush(
|
||||
const baseUrl = repoBaseUrl(payload, repo);
|
||||
const forced = payload.forced as boolean | undefined;
|
||||
const created = payload.created as boolean | undefined;
|
||||
const deleted = payload.deleted as boolean | undefined;
|
||||
const em = (e: string): string => emojiPrefix(e, showEmoji);
|
||||
|
||||
// A branch/tag deletion pushed via `git push --delete` arrives as a push
|
||||
// event with `deleted: true` and no commits — render it like the `delete`
|
||||
// event instead of a confusing "0 commits pushed".
|
||||
if (deleted) {
|
||||
const refType = isTagPush ? "tag" : "branch";
|
||||
return buildMessage(
|
||||
{
|
||||
author,
|
||||
title: t("events.delete.title", {
|
||||
repo: repo ?? t("common.repository"),
|
||||
emoji: em(isTagPush ? "🏷️" : "🌿"),
|
||||
type: refType,
|
||||
ref: isTagPush ? tagLink(baseUrl, rawRef, ref) : branchLink(baseUrl, rawRef, ref),
|
||||
}),
|
||||
color: GITHUB_COLORS.delete,
|
||||
},
|
||||
t,
|
||||
repo,
|
||||
);
|
||||
}
|
||||
|
||||
const descriptionParts: string[] = [];
|
||||
|
||||
if (forced) {
|
||||
|
||||
Reference in new issue
Block a user