diff --git a/event_webhook_types.go b/event_webhook_types.go index 504444432..1b9b2d424 100644 --- a/event_webhook_types.go +++ b/event_webhook_types.go @@ -184,6 +184,7 @@ type DeploymentEvent struct { // https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#comment-on-an-issue type IssueCommentEvent struct { ObjectKind string `json:"object_kind"` + EventType string `json:"event_type"` User *User `json:"user"` ProjectID int `json:"project_id"` Project struct { @@ -246,6 +247,8 @@ type IssueCommentEvent struct { HumanTimeEstimate string `json:"human_time_estimate"` AssigneeIDs []int `json:"assignee_ids"` AssigneeID int `json:"assignee_id"` + Position int `json:"position"` + BranchName string `json:"branch_name"` } `json:"issue"` } diff --git a/event_webhook_types_test.go b/event_webhook_types_test.go index 421e3c685..cc5fcc103 100644 --- a/event_webhook_types_test.go +++ b/event_webhook_types_test.go @@ -205,6 +205,10 @@ func TestIssueCommentEventUnmarshal(t *testing.T) { t.Errorf("ObjectKind is %v, want %v", event.ObjectKind, NoteEventTargetType) } + if event.EventType != "note" { + t.Errorf("EventType is %v, want %v", event.EventType, "note") + } + if event.ProjectID != 5 { t.Errorf("ProjectID is %v, want %v", event.ProjectID, 5) } @@ -221,6 +225,14 @@ func TestIssueCommentEventUnmarshal(t *testing.T) { t.Errorf("Issue title is %v, want %v", event.Issue.Title, "test_issue") } + if event.Issue.Position != 0 { + t.Errorf("Issue position is %v, want %v", event.Issue.Position, 0) + } + + if event.Issue.BranchName != "" { + t.Errorf("Issue branch name is %v, want %v", event.Issue.BranchName, "") + } + if len(event.Issue.Labels) == 0 || event.Issue.Labels[0].ID != 25 { t.Errorf("Label id is null") } diff --git a/testdata/webhooks/note_issue.json b/testdata/webhooks/note_issue.json index 2844ae590..4d36b2008 100644 --- a/testdata/webhooks/note_issue.json +++ b/testdata/webhooks/note_issue.json @@ -1,5 +1,6 @@ { "object_kind": "note", + "event_type": "note", "user": { "id": 42, "name": "User1",