✨Feat: 接收解析 WebHook 信息

This commit is contained in:
2025-10-13 13:49:39 +08:00
parent f93c49659d
commit adad851991
9 changed files with 171 additions and 0 deletions
@@ -0,0 +1,34 @@
package cn.hezhaohui.webhook.service;
import cn.hezhaohui.lark.entity.CardData;
import cn.hezhaohui.lark.util.Lark;
import cn.hezhaohui.webhook.entity.GiteaPushEvent;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class HookService {
public void handlePush(GiteaPushEvent event) {
List<String> commitMsgList = event.getCommits().stream()
.map(GiteaPushEvent.Commit::getMessage)
.toList();
CardData cardData = CardData.builder()
.title("[Gitea] 仓库状态变化")
.repo(event.getRepository().getName())
.link(event.getRepository().getHtml_url())
.msg(String.join("\n", commitMsgList))
.tag("PUSH")
.subtitle("Ciallo~(∠・ω< )⌒★")
.ai("待开发")
.build();
try {
Lark.sendCardMessage(cardData);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}