From be64b88655cb193ab098ef32753be6bcd0e2a88581e4b84973a2a2334402535e Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Mon, 26 Aug 2024 13:06:44 +0200 Subject: [PATCH] . --- bots-common/request_pr.go | 14 ++++++++------ gitea-events-rabbitmq-publisher/main.go | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/bots-common/request_pr.go b/bots-common/request_pr.go index a5feab5..7408c4f 100644 --- a/bots-common/request_pr.go +++ b/bots-common/request_pr.go @@ -28,9 +28,10 @@ type PullRequest struct { Number int State string - Base Head - Labels []IssueLabelDetail - Head Head + Base Head + Head Head + Labels []IssueLabelDetail + Requested_reviewers []*User User User } @@ -39,9 +40,10 @@ type PullRequestWebhookEvent struct { Action string Number int - Pull_Request PullRequest - Repository Repository - Sender User + Pull_Request PullRequest + Repository Repository + Requested_reviewer User + Sender User } func (h *RequestHandler) parsePullRequest(data io.Reader) *PullRequestWebhookEvent { diff --git a/gitea-events-rabbitmq-publisher/main.go b/gitea-events-rabbitmq-publisher/main.go index 2e98e84..6367df9 100644 --- a/gitea-events-rabbitmq-publisher/main.go +++ b/gitea-events-rabbitmq-publisher/main.go @@ -230,6 +230,21 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex org = issue.Repository.Owner extraAction = issue.Action + case "pull_request_review_request": + issue := common.PullRequestWebhookEvent{} + if err = json.Unmarshal(data, &issue); err != nil { + return + } + switch issue.Action { + case "review_requested", "review_request_removed": + break + default: + err = fmt.Errorf("Unknown PR Assign webhook action type: %s", issue.Action) + return + } + org = issue.Repository.Owner + extraAction = issue.Action + default: // TODO: package and wiki err = fmt.Errorf("Unknown webhook request type: %s", reqType)