Skip to content

Commit

Permalink
Add NodeID to all GenericCommentEvent's
Browse files Browse the repository at this point in the history
Signed-off-by: Eddie Zaneski <eddiezane@gmail.com>
  • Loading branch information
eddiezane committed Aug 12, 2021
1 parent b89147b commit 4024d2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion prow/github/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ const (
// PullRequest contains information about a PullRequest.
type PullRequest struct {
ID int `json:"id"`
NodeID string `json:"node_id"`
Number int `json:"number"`
HTMLURL string `json:"html_url"`
User User `json:"user"`
Expand Down Expand Up @@ -906,6 +907,7 @@ const (
// Review describes a Pull Request review.
type Review struct {
ID int `json:"id"`
NodeID string `json:"node_id"`
User User `json:"user"`
Body string `json:"body"`
State ReviewState `json:"state"`
Expand Down Expand Up @@ -952,6 +954,7 @@ const (
// ReviewComment describes a Pull Request review.
type ReviewComment struct {
ID int `json:"id"`
NodeID string `json:"node_id"`
ReviewID int `json:"pull_request_review_id"`
User User `json:"user"`
Body string `json:"body"`
Expand Down Expand Up @@ -1170,7 +1173,8 @@ const (
// Issue and PR "closed" events are not coerced to the "deleted" Action and do not trigger
// a GenericCommentEvent because these events don't actually remove the comment content from GH.
type GenericCommentEvent struct {
ID int `json:"id"`
ID int `json:"id"`
NodeID string `json:"node_id"`
CommentID *int
IsPR bool
Action GenericCommentEventAction
Expand Down
5 changes: 5 additions & 0 deletions prow/hook/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func (s *Server) handleReviewEvent(l *logrus.Entry, re github.ReviewEvent) {
l,
&github.GenericCommentEvent{
GUID: re.GUID,
NodeID: re.Review.NodeID,
IsPR: true,
Action: action,
Body: re.Review.Body,
Expand Down Expand Up @@ -163,6 +164,7 @@ func (s *Server) handleReviewCommentEvent(l *logrus.Entry, rce github.ReviewComm
l,
&github.GenericCommentEvent{
GUID: rce.GUID,
NodeID: rce.Comment.NodeID,
IsPR: true,
CommentID: intPtr(rce.Comment.ID),
Action: action,
Expand Down Expand Up @@ -221,6 +223,7 @@ func (s *Server) handlePullRequestEvent(l *logrus.Entry, pr github.PullRequestEv
l,
&github.GenericCommentEvent{
ID: pr.PullRequest.ID,
NodeID: pr.PullRequest.NodeID,
GUID: pr.GUID,
IsPR: true,
Action: action,
Expand Down Expand Up @@ -304,6 +307,7 @@ func (s *Server) handleIssueEvent(l *logrus.Entry, i github.IssueEvent) {
l,
&github.GenericCommentEvent{
ID: i.Issue.ID,
NodeID: i.Issue.NodeID,
GUID: i.GUID,
IsPR: i.Issue.IsPullRequest(),
Action: action,
Expand Down Expand Up @@ -360,6 +364,7 @@ func (s *Server) handleIssueCommentEvent(l *logrus.Entry, ic github.IssueComment
l,
&github.GenericCommentEvent{
ID: ic.Issue.ID,
NodeID: ic.Issue.NodeID,
CommentID: intPtr(ic.Comment.ID),
GUID: ic.GUID,
IsPR: ic.Issue.IsPullRequest(),
Expand Down

0 comments on commit 4024d2d

Please sign in to comment.