This commit is contained in:
Adam Majer 2024-08-26 13:39:36 +02:00
parent 4146290df8
commit 57af3812c0

View File

@ -134,7 +134,7 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex
case "edited", "created", "deleted":
break
default:
err = fmt.Errorf("Unknown Issue Comment webhook action type: %s", issue.Action)
err = fmt.Errorf("Unknown Issue/PR Comment webhook action type: %s", issue.Action)
return
}
org = issue.Repository.Owner
@ -239,27 +239,41 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex
case "review_requested", "review_request_removed":
break
default:
err = fmt.Errorf("Unknown PR Assign webhook action type: %s", issue.Action)
err = fmt.Errorf("Unknown PR Review Request webhook action type: %s", issue.Action)
return
}
org = issue.Repository.Owner
extraAction = issue.Action
case "pull_request_review_rejected", "pull_request_review_approved":
issue := common.PullRequestWebhookEvent{}
if err = json.Unmarshal(data, &issue); err != nil {
pr := common.PullRequestWebhookEvent{}
if err = json.Unmarshal(data, &pr); err != nil {
return
}
switch issue.Action {
switch pr.Action {
case "reviewed":
break
default:
err = fmt.Errorf("Unknown PR Assign webhook action type: %s", issue.Action)
err = fmt.Errorf("Unknown PR Review webhook action type: %s", pr.Action)
return
}
org = issue.Repository.Owner
extraAction = issue.Action
org = pr.Repository.Owner
extraAction = ""
case "pull_request_sync":
pr := common.PullRequestWebhookEvent{}
if err = json.Unmarshal(data, &pr); err != nil {
return
}
switch pr.Action {
case "synchronized":
break
default:
err = fmt.Errorf("Unknown PR Sync webhook action type: %s", pr.Action)
return
}
org = pr.Repository.Owner
extraAction = ""
default:
// TODO: package and wiki