Skip to content

Commit 27af3ec

Browse files
authored
Merge pull request #14 from Nullify-Platform/azure-pr-comment
azure pull request comments
2 parents d95ffaf + 3350fd1 commit 27af3ec

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

azuredevops/azuredevops.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const (
2727
GitPullRequestUpdatedEventType Event = "git.pullrequest.updated"
2828
GitPullRequestMergedEventType Event = "git.pullrequest.merged"
2929
GitPushEventType Event = "git.push"
30+
GitPullRequestCommentEventType Event = "ms.vss-code.git-pullrequest-comment-event"
3031
)
3132

3233
// Webhook instance contains all methods needed to process events
@@ -74,6 +75,10 @@ func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)
7475
var fpl BuildCompleteEvent
7576
err = json.Unmarshal([]byte(payload), &fpl)
7677
return fpl, err
78+
case GitPullRequestCommentEventType:
79+
var fpl GitPullRequestCommentEvent
80+
err = json.Unmarshal([]byte(payload), &fpl)
81+
return fpl, err
7782
default:
7883
return nil, fmt.Errorf("unknown event %s", pl.EventType)
7984
}

azuredevops/payload.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ type GitPushEvent struct {
5151
Scope string `json:"scope"`
5252
}
5353

54+
// "ms.vss-code.git-pullrequest-comment-event"
55+
56+
type GitPullRequestCommentEvent struct {
57+
ID string `json:"id"`
58+
EventType Event `json:"eventType"`
59+
PublisherID string `json:"publisherId"`
60+
Scope string `json:"scope"`
61+
Message Message `json:"message"`
62+
Resource PullRequestComment `json:"resource"`
63+
}
64+
5465
// build.complete
5566

5667
type BuildCompleteEvent struct {
@@ -100,6 +111,22 @@ type PullRequest struct {
100111
URL string `json:"url"`
101112
}
102113

114+
type PullRequestComment struct {
115+
PullRequest PullRequest `json:"pullRequest"`
116+
Comment Comment `json:"comment"`
117+
}
118+
119+
type Comment struct {
120+
ID int `json:"id"`
121+
ParentCommentID int `json:"parentCommentId"`
122+
Content string `json:"content"`
123+
Author User `json:"author"`
124+
PublishedDate Date `json:"publishedDate"`
125+
LastUpdatedDate Date `json:"lastUpdatedDate"`
126+
LastContentUpdatedDate Date `json:"lastContentUpdatedDate"`
127+
CommentType string `json:"commentType"`
128+
}
129+
103130
type Repository struct {
104131
ID string `json:"id"`
105132
Name string `json:"name"`

0 commit comments

Comments
 (0)