.
This commit is contained in:
parent
3df22a72bb
commit
2e2cf023c6
@ -18,8 +18,15 @@ const RequestType_Push = "push"
|
||||
const RequestType_Repository = "repository"
|
||||
const RequestType_Release = "release"
|
||||
const RequestType_PR = "pull_request"
|
||||
const RequestType_PRAssign = "pull_request_assign"
|
||||
const ReqeustType_PRLabel = "pull_request_label"
|
||||
const RequestType_PRComment = "pull_request_comment"
|
||||
const RequestType_PR_sync = "pull_request_sync"
|
||||
const RequestType_PRMilestone = "pull_request_milestone"
|
||||
const RequestType_PRSync = "pull_request_sync"
|
||||
const RequestType_PRReviewAccepted = "pull_request_review_approved"
|
||||
const RequestType_PRReviewRejected = "pull_request_review_rejected"
|
||||
const RequestType_PRReviewRequest = "pull_request_review_request"
|
||||
const RequestType_Wiki = "wiki"
|
||||
|
||||
type RequestProcessor func(*RequestHandler) error
|
||||
|
||||
@ -66,7 +73,7 @@ func StartServerWithAddress(listenDefs ListenDefinitions, addr string) {
|
||||
h.parsePushRequest(req.Body)
|
||||
case RequestType_PR:
|
||||
h.parsePullRequest(req.Body)
|
||||
case RequestType_PR_sync:
|
||||
case RequestType_PRSync:
|
||||
h.parsePullRequestSync(req.Body)
|
||||
default:
|
||||
h.ErrLogger.Printf("Unhandled request type: %s\n", reqType)
|
||||
|
@ -185,7 +185,7 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex
|
||||
org = pr.Repository.Owner
|
||||
extraAction = pr.Action
|
||||
|
||||
case "pull_request_label":
|
||||
case common.RequestType_PRLabel:
|
||||
pr := common.PullRequestWebhookEvent{}
|
||||
if err = json.Unmarshal(data, &pr); err != nil {
|
||||
return
|
||||
@ -200,7 +200,7 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex
|
||||
org = pr.Repository.Owner
|
||||
extraAction = pr.Action
|
||||
|
||||
case "pull_request_milestone":
|
||||
case common.RequestType_PRMilestone:
|
||||
pr := common.PullRequestWebhookEvent{}
|
||||
if err = json.Unmarshal(data, &pr); err != nil {
|
||||
return
|
||||
@ -215,7 +215,7 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex
|
||||
org = pr.Repository.Owner
|
||||
extraAction = pr.Action
|
||||
|
||||
case "pull_request_assign":
|
||||
case common.RequestType_PRAssign:
|
||||
issue := common.PullRequestWebhookEvent{}
|
||||
if err = json.Unmarshal(data, &issue); err != nil {
|
||||
return
|
||||
@ -230,7 +230,7 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex
|
||||
org = issue.Repository.Owner
|
||||
extraAction = issue.Action
|
||||
|
||||
case "pull_request_review_request":
|
||||
case common.RequestType_PRReviewRequest:
|
||||
issue := common.PullRequestWebhookEvent{}
|
||||
if err = json.Unmarshal(data, &issue); err != nil {
|
||||
return
|
||||
@ -245,7 +245,7 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex
|
||||
org = issue.Repository.Owner
|
||||
extraAction = issue.Action
|
||||
|
||||
case "pull_request_review_rejected", "pull_request_review_approved":
|
||||
case common.RequestType_PRReviewAccepted, common.RequestType_PRReviewRejected:
|
||||
pr := common.PullRequestWebhookEvent{}
|
||||
if err = json.Unmarshal(data, &pr); err != nil {
|
||||
return
|
||||
@ -260,7 +260,7 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex
|
||||
org = pr.Repository.Owner
|
||||
extraAction = ""
|
||||
|
||||
case common.RequestType_PR_sync:
|
||||
case common.RequestType_PRSync:
|
||||
pr := common.PullRequestWebhookEvent{}
|
||||
if err = json.Unmarshal(data, &pr); err != nil {
|
||||
return
|
||||
@ -275,7 +275,7 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex
|
||||
org = pr.Repository.Owner
|
||||
extraAction = ""
|
||||
|
||||
case "wiki":
|
||||
case common.RequestType_Wiki:
|
||||
wiki := common.WikiWebhookEvent{}
|
||||
if err = json.Unmarshal(data, &wiki); err != nil {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user