fix(pr): pr +view 补齐 merged_at 字段
CI / Build, Lint, Test (pull_request) Failing after 1m15s Details

上游 #14 报告 pr +view 返回缺少 merged_at 字段(参照平台 API 文档)。
enrichPullRequestClosedAt 此前只从 journals 回填 closed_at,未处理
merged_at。本次从 pull_request.merged_at 提取并回填到顶层,对齐
已有 closed_at 的处理风格。

修复 #5
This commit is contained in:
wauxing 2026-06-29 09:12:12 +08:00
parent 71ca2bb683
commit 48ccd22682
1 changed files with 11 additions and 1 deletions

View File

@ -476,7 +476,17 @@ func enrichPullRequestClosedAt(ctx *common.RuntimeContext, env *output.Envelope)
return nil
}
pr, ok := data["pull_request"].(map[string]interface{})
if !ok || !isClosedPullRequest(pr) || stringField(pr, "closed_at") != "" {
if !ok {
return nil
}
// Backfill merged_at from the pull_request payload if missing. Issue #14
// reported that pr +view lacked merged_at even though the API docs expose it.
if mergedAt := stringField(pr, "merged_at"); mergedAt != "" {
if _, has := data["merged_at"]; !has {
data["merged_at"] = mergedAt
}
}
if !isClosedPullRequest(pr) || stringField(pr, "closed_at") != "" {
return nil
}
issue, ok := data["issue"].(map[string]interface{})