diff --git a/bots-common/request_issue.go b/bots-common/request_issue.go index dd87f11..310cddb 100644 --- a/bots-common/request_issue.go +++ b/bots-common/request_issue.go @@ -21,3 +21,22 @@ type IssueWebhookEvent struct { Sender *User } +type CommentDetail struct { + Id int + Issue_Url string + Pull_Request_Url string + User *User + Body string + + Created_At string + Updated_At string +} + +type IssueCommentWebhookEvent struct { + Action string + + Issue *IssueDetail + Comment *CommentDetail + Repository *Repository + Sender *User +} diff --git a/gitea-events-rabbitmq-publisher/main.go b/gitea-events-rabbitmq-publisher/main.go index 70375cd..877bdcb 100644 --- a/gitea-events-rabbitmq-publisher/main.go +++ b/gitea-events-rabbitmq-publisher/main.go @@ -125,6 +125,21 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex org = issue.Repository.Owner extraAction = issue.Action + case "issue_comment": + issue := common.IssueCommentWebhookEvent{} + if err = json.Unmarshal(data, &issue); err != nil { + return + } + switch issue.Action { + case "edited", "created", "deleted": + break + default: + err = fmt.Errorf("Unknown Issue Comment webhook action type: %s", issue.Action) + return + } + org = issue.Repository.Owner + extraAction = issue.Action + // case "issue_comment": // case "issue_labelled":