Skip to content
5 changes: 5 additions & 0 deletions azuredevops/azuredevops.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
GitPullRequestUpdatedEventType Event = "git.pullrequest.updated"
GitPullRequestMergedEventType Event = "git.pullrequest.merged"
GitPushEventType Event = "git.push"
GitPullRequestCommentEventType Event = "ms.vss-code.git-pullrequest-comment-event"
)

// Webhook instance contains all methods needed to process events
Expand Down Expand Up @@ -74,6 +75,10 @@ func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)
var fpl BuildCompleteEvent
err = json.Unmarshal([]byte(payload), &fpl)
return fpl, err
case GitPullRequestCommentEventType:
var fpl GitPullRequestCommentEvent
err = json.Unmarshal([]byte(payload), &fpl)
return fpl, err
default:
return nil, fmt.Errorf("unknown event %s", pl.EventType)
}
Expand Down
27 changes: 27 additions & 0 deletions azuredevops/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ type GitPushEvent struct {
Scope string `json:"scope"`
}

// "ms.vss-code.git-pullrequest-comment-event"

type GitPullRequestCommentEvent struct {
ID string `json:"id"`
EventType Event `json:"eventType"`
PublisherID string `json:"publisherId"`
Scope string `json:"scope"`
Message Message `json:"message"`
Resource PullRequestComment `json:"resource"`
}

// build.complete

type BuildCompleteEvent struct {
Expand Down Expand Up @@ -100,6 +111,22 @@ type PullRequest struct {
URL string `json:"url"`
}

type PullRequestComment struct {
PullRequest PullRequest `json:"pullRequest"`
Comment Comment `json:"comment"`
}

type Comment struct {
ID int `json:"id"`
ParentCommentID int `json:"parentCommentId"`
Content string `json:"content"`
Author User `json:"author"`
PublishedDate Date `json:"publishedDate"`
LastUpdatedDate Date `json:"lastUpdatedDate"`
LastContentUpdatedDate Date `json:"lastContentUpdatedDate"`
CommentType string `json:"commentType"`
}

type Repository struct {
ID string `json:"id"`
Name string `json:"name"`
Expand Down