From ce1d5dd7fe9de1b77290c53c29aee15216d1b449 Mon Sep 17 00:00:00 2001 From: Wonder Date: Mon, 13 Oct 2025 15:02:00 +0800 Subject: [PATCH] =?UTF-8?q?=20=E2=9C=A8Feat:=20=E8=8E=B7=E5=8F=96=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hezhaohui/webhook/entity/GiteaPushEvent.java | 4 +++- .../hezhaohui/webhook/service/HookService.java | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gitea-webhook/src/main/java/cn/hezhaohui/webhook/entity/GiteaPushEvent.java b/gitea-webhook/src/main/java/cn/hezhaohui/webhook/entity/GiteaPushEvent.java index 7fd11ec..e322a34 100644 --- a/gitea-webhook/src/main/java/cn/hezhaohui/webhook/entity/GiteaPushEvent.java +++ b/gitea-webhook/src/main/java/cn/hezhaohui/webhook/entity/GiteaPushEvent.java @@ -6,7 +6,6 @@ import java.util.List; @Data public class GiteaPushEvent { - private String secret; private String ref; private String before; private String after; @@ -35,6 +34,9 @@ public class GiteaPushEvent { private User author; private User committer; private String timestamp; + private List added; + private List removed; + private List modified; } @Data diff --git a/gitea-webhook/src/main/java/cn/hezhaohui/webhook/service/HookService.java b/gitea-webhook/src/main/java/cn/hezhaohui/webhook/service/HookService.java index d7c27c3..f3219c7 100644 --- a/gitea-webhook/src/main/java/cn/hezhaohui/webhook/service/HookService.java +++ b/gitea-webhook/src/main/java/cn/hezhaohui/webhook/service/HookService.java @@ -6,6 +6,7 @@ import cn.hezhaohui.webhook.entity.GiteaPushEvent; import org.springframework.stereotype.Service; import java.util.List; +import java.util.stream.Stream; @Service public class HookService { @@ -14,6 +15,21 @@ public class HookService { List commitMsgList = event.getCommits().stream() .map(GiteaPushEvent.Commit::getMessage) .toList(); + + List addedFiles = event.getCommits().stream() + .flatMap(commit -> commit.getAdded().stream()) + .toList(); + + List removedFiles = event.getCommits().stream() + .flatMap(commit -> commit.getRemoved().stream()) + .toList(); + + List modifiedFiles = event.getCommits().stream() + .flatMap(commit -> commit.getModified().stream()) + .toList(); + + // TODO: 调用 AI 模块 + CardData cardData = CardData.builder() .title("[Gitea] 仓库状态变化") .repo(event.getRepository().getName())