Skip to content

Commit ddfb6ca

Browse files
committed
fix: log edited comment events at debug level instead of error
Edited or deleted issue comments on GitHub trigger a webhook that reaches processEvent(), which returned an error for any non-"created" action. That error propagated up to sinker and was logged as Errorf, producing scary log entries for a normal, harmless event. Replace the error return with a debug log and nil,nil return so these events are silently skipped, matching the existing skip pattern used elsewhere in the file. Signed-off-by: majiayu000 <1835304752@qq.com>
1 parent 92a3273 commit ddfb6ca

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/provider/github/parse_payload.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ func (v *Provider) processEvent(ctx context.Context, event *info.Event, eventInt
354354
"exiting... (hint: did you forget setting a secret on your repo?)")
355355
}
356356
if gitEvent.GetAction() != "created" {
357-
return nil, fmt.Errorf("only newly created comment is supported, received: %s", gitEvent.GetAction())
357+
v.Logger.Debugf("only newly created comment is supported, received: %s, skipping", gitEvent.GetAction())
358+
return nil, nil
358359
}
359360
processedEvent, err = v.handleIssueCommentEvent(ctx, gitEvent)
360361
if err != nil {

pkg/provider/github/parse_payload_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,7 @@ func TestParsePayLoad(t *testing.T) {
745745
},
746746
},
747747
{
748-
name: "bad/issue_comment_not_from_created",
749-
wantErrString: "only newly created comment is supported, received: deleted",
748+
name: "good/issue_comment_not_from_created_skip",
750749
payloadEventStruct: github.IssueCommentEvent{Action: github.Ptr("deleted")},
751750
eventType: "issue_comment",
752751
triggerTarget: "pull_request",

0 commit comments

Comments
 (0)