.
This commit is contained in:
parent
e0134baadc
commit
01920900dd
@ -185,8 +185,53 @@ func parseRequestJSON(reqType string, data []byte) (org *common.Organization, ex
|
||||
org = pr.Repository.Owner
|
||||
extraAction = pr.Action
|
||||
|
||||
case "pull_request_label":
|
||||
pr := common.PullRequestWebhookEvent{}
|
||||
if err = json.Unmarshal(data, &pr); err != nil {
|
||||
return
|
||||
}
|
||||
switch pr.Action {
|
||||
case "label_updated", "label_cleared":
|
||||
break
|
||||
default:
|
||||
err = fmt.Errorf("Unknown PR Label webhook action type: %s", pr.Action)
|
||||
return
|
||||
}
|
||||
org = pr.Repository.Owner
|
||||
extraAction = pr.Action
|
||||
|
||||
case "pull_request_milestone":
|
||||
pr := common.PullRequestWebhookEvent{}
|
||||
if err = json.Unmarshal(data, &pr); err != nil {
|
||||
return
|
||||
}
|
||||
switch pr.Action {
|
||||
case "milestoned", "demilestoned":
|
||||
break
|
||||
default:
|
||||
err = fmt.Errorf("Unknown PR Milestone webhook action type: %s", pr.Action)
|
||||
return
|
||||
}
|
||||
org = pr.Repository.Owner
|
||||
extraAction = pr.Action
|
||||
|
||||
case "pull_request_assign":
|
||||
issue := common.PullRequestWebhookEvent{}
|
||||
if err = json.Unmarshal(data, &issue); err != nil {
|
||||
return
|
||||
}
|
||||
switch issue.Action {
|
||||
case "assigned", "unassigned":
|
||||
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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user