Skip to content

Commit 192f9d3

Browse files
apurwaj2exageraldo
authored andcommitted
Add DicussionCommentEvent Webhook (google#2678)
Fixes: google#2497.
1 parent 178f004 commit 192f9d3

File tree

8 files changed

+791
-0
lines changed

8 files changed

+791
-0
lines changed

github/event.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ func (e *Event) ParsePayload() (payload interface{}, err error) {
5353
payload = &DeploymentStatusEvent{}
5454
case "DiscussionEvent":
5555
payload = &DiscussionEvent{}
56+
case "DiscussionCommentEvent":
57+
payload = &DiscussionCommentEvent{}
5658
case "ForkEvent":
5759
payload = &ForkEvent{}
5860
case "GitHubAppAuthorizationEvent":

github/event_types.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,39 @@ type DeploymentStatusEvent struct {
189189
Installation *Installation `json:"installation,omitempty"`
190190
}
191191

192+
// DiscussionCommentEvent represents a webhook event for a comment on discussion.
193+
// The Webhook event name is "discussion_comment".
194+
//
195+
// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion_comment
196+
type DiscussionCommentEvent struct {
197+
// Action is the action that was performed on the comment.
198+
// Possible values are: "created", "edited", "deleted". ** check what all can be added
199+
Action *string `json:"action,omitempty"`
200+
Discussion *Discussion `json:"discussion,omitempty"`
201+
Comment *CommentDiscussion `json:"comment,omitempty"`
202+
Repo *Repository `json:"repository,omitempty"`
203+
Org *Organization `json:"organization,omitempty"`
204+
Sender *User `json:"sender,omitempty"`
205+
Installation *Installation `json:"installation,omitempty"`
206+
}
207+
208+
// CommentDiscussion represents a comment in a GitHub DiscussionCommentEvent.
209+
type CommentDiscussion struct {
210+
AuthorAssociation *string `json:"author_association,omitempty"`
211+
Body *string `json:"body,omitempty"`
212+
ChildCommentCount *int `json:"child_comment_count,omitempty"`
213+
CreatedAt *Timestamp `json:"created_at,omitempty"`
214+
DiscussionID *int64 `json:"discussion_id,omitempty"`
215+
HTMLURL *string `json:"html_url,omitempty"`
216+
ID *int64 `json:"id,omitempty"`
217+
NodeID *string `json:"node_id,omitempty"`
218+
ParentID *int64 `json:"parent_id,omitempty"`
219+
Reactions *Reactions `json:"reactions,omitempty"`
220+
RepositoryURL *string `json:"repository_url,omitempty"`
221+
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
222+
User *User `json:"user,omitempty"`
223+
}
224+
192225
// DiscussionEvent represents a webhook event for a discussion.
193226
// The Webhook event name is "discussion".
194227
//

0 commit comments

Comments
 (0)