webhook: support Issues event (#2319)

Also addresses #3485.
This commit is contained in:
Unknwon
2017-03-09 00:03:29 -05:00
parent bab448681d
commit c93731339f
20 changed files with 1257 additions and 1165 deletions

View File

@@ -239,6 +239,8 @@ const (
HOOK_ISSUE_UNASSIGNED HookIssueAction = "unassigned"
HOOK_ISSUE_LABEL_UPDATED HookIssueAction = "label_updated"
HOOK_ISSUE_LABEL_CLEARED HookIssueAction = "label_cleared"
HOOK_ISSUE_MILESTONED HookIssueAction = "milestoned"
HOOK_ISSUE_DEMILESTONED HookIssueAction = "demilestoned"
HOOK_ISSUE_SYNCHRONIZED HookIssueAction = "synchronized"
)
@@ -251,6 +253,19 @@ type ChangesPayload struct {
Body *ChangesFromPayload `json:"body,omitempty"`
}
type IssuesPayload struct {
Action HookIssueAction `json:"action"`
Index int64 `json:"number"`
Issue *Issue `json:"issue"`
Changes *ChangesPayload `json:"changes,omitempty"`
Repository *Repository `json:"repository"`
Sender *User `json:"sender"`
}
func (p *IssuesPayload) JSONPayload() ([]byte, error) {
return json.MarshalIndent(p, "", " ")
}
// __________ .__ .__ __________ __
// \______ \__ __| | | | \______ \ ____ ________ __ ____ _______/ |_
// | ___/ | \ | | | | _// __ \/ ____/ | \_/ __ \ / ___/\ __\
@@ -262,8 +277,8 @@ type ChangesPayload struct {
type PullRequestPayload struct {
Action HookIssueAction `json:"action"`
Index int64 `json:"number"`
Changes *ChangesPayload `json:"changes,omitempty"`
PullRequest *PullRequest `json:"pull_request"`
Changes *ChangesPayload `json:"changes,omitempty"`
Repository *Repository `json:"repository"`
Sender *User `json:"sender"`
}