Skip to content

Commit 9a5c92c

Browse files
committed
fix(webhook):avoid respoding /code in pr
1 parent b9a7a7d commit 9a5c92c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

internal/webhook/handler.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,16 @@ func (h *Handler) handleIssueComment(ctx context.Context, w http.ResponseWriter,
200200
}
201201
}
202202

203-
// 处理 Issue 的 /code 命令
203+
// Handle /code command for Issues only (not for PRs)
204204
if strings.HasPrefix(comment, "/code") {
205+
// Check if this is a PR comment, ignore if it is
206+
if event.Issue.PullRequestLinks != nil {
207+
log.Infof("Ignoring /code command in PR #%d (use /continue or /fix instead)", issueNumber)
208+
w.WriteHeader(http.StatusOK)
209+
w.Write([]byte("/code command is not supported in PRs, use /continue or /fix instead"))
210+
return
211+
}
212+
205213
log.Infof("Received /code command for Issue: %s, title: %s",
206214
event.Issue.GetHTMLURL(), issueTitle)
207215

0 commit comments

Comments
 (0)