diff --git a/vars/notifyLark.groovy b/vars/notifyLark.groovy
index 425e708..47bad05 100644
--- a/vars/notifyLark.groovy
+++ b/vars/notifyLark.groovy
@@ -1,3 +1,34 @@
+def buildCommitDiffMarkdown() {
+ def changeSets = currentBuild.changeSets
+
+ if (!changeSets || changeSets.isEmpty()) {
+ return '_本次构建无代码变更_'
+ }
+
+ def commits = []
+
+ changeSets.each { cs ->
+ cs.items.each { item ->
+ def author = item.author?.fullName ?: 'unknown'
+ def msg = item.msg?.trim()?.replaceAll('[\\r\\n]+', ' ')
+ commits << "- **${msg}**(${author})"
+ }
+ }
+
+ if (commits.isEmpty()) {
+ return '_本次构建无代码变更_'
+ }
+
+ // 防止消息过长(飞书卡片有长度限制)
+ def maxCommits = 5
+ if (commits.size() > maxCommits) {
+ commits = commits.take(maxCommits)
+ commits << "_……以及更多提交_"
+ }
+
+ return commits.join('\n')
+}
+
def call(Map args = [:]) {
// ===== 参数 =====
@@ -32,7 +63,8 @@ def call(Map args = [:]) {
ABORTED : "已中止"
][buildStatus] ?: "未知状态"
- def commitDiff = "[查看变更记录](${buildUrl}changes)"
+ // def commitDiff = "[查看变更记录](${buildUrl}changes)"
+ def commitDiff = buildCommitDiffMarkdown()
// ===== 凭证 =====
withCredentials([