Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DicussionCommentEvent Webhook #2678

Merged
merged 2 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions github/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func (e *Event) ParsePayload() (payload interface{}, err error) {
payload = &DeploymentStatusEvent{}
case "DiscussionEvent":
payload = &DiscussionEvent{}
case "DiscussionCommentEvent":
payload = &DiscussionCommentEvent{}
case "ForkEvent":
payload = &ForkEvent{}
case "GitHubAppAuthorizationEvent":
Expand Down
33 changes: 33 additions & 0 deletions github/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,39 @@ type DeploymentStatusEvent struct {
Installation *Installation `json:"installation,omitempty"`
}

// DiscussionCommentEvent represents a webhook event for a comment on discussion.
// The Webhook event name is "discussion_comment".
//
// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion_comment
type DiscussionCommentEvent struct {
// Action is the action that was performed on the comment.
// Possible values are: "created", "edited", "deleted". ** check what all can be added
Action *string `json:"action,omitempty"`
Discussion *Discussion `json:"discussion,omitempty"`
Comment *CommentDiscussion `json:"comment,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}

// CommentDiscussion represents a comment in a GitHub DiscussionCommentEvent.
type CommentDiscussion struct {
AuthorAssociation *string `json:"author_association,omitempty"`
Body *string `json:"body,omitempty"`
ChildCommentCount *int `json:"child_comment_count,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
DiscussionID *int64 `json:"discussion_id,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
ParentID *int64 `json:"parent_id,omitempty"`
Reactions *Reactions `json:"reactions,omitempty"`
RepositoryURL *string `json:"repository_url,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
}

// DiscussionEvent represents a webhook event for a discussion.
// The Webhook event name is "discussion".
//
Expand Down