Skip to content

Commit 02d182a

Browse files
authored
feat: add draft to gitlab merge-request-event payload (#190)
1 parent 2fe5d09 commit 02d182a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

gitlab/payload.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@ type ObjectAttributes struct {
724724
NoteableID int64 `json:"noteable_id"` // nolint: misspell
725725
System bool `json:"system"`
726726
WorkInProgress bool `json:"work_in_progress"`
727+
Draft bool `json:"draft"`
727728
StDiffs []StDiff `json:"st_diffs"`
728729
Source Source `json:"source"`
729730
Target Target `json:"target"`
@@ -880,14 +881,21 @@ type Author struct {
880881
// Changes contains all changes associated with a GitLab issue or MR
881882
type Changes struct {
882883
LabelChanges LabelChanges `json:"labels"`
884+
DraftChanges DraftChanges `json:"draft"`
883885
}
884886

885-
// LabelChanges contains changes in labels assocatiated with a GitLab issue or MR
887+
// LabelChanges contains changes in labels associated with a GitLab issue or MR
886888
type LabelChanges struct {
887889
Previous []Label `json:"previous"`
888890
Current []Label `json:"current"`
889891
}
890892

893+
// DraftChanges contains the current and previous value of the draft property, tells us if draft was toggles
894+
type DraftChanges struct {
895+
Previous bool `json:"previous"`
896+
Current bool `json:"current"`
897+
}
898+
891899
// Label contains all of the GitLab label information
892900
type Label struct {
893901
ID int64 `json:"id"`

testdata/gitlab/merge-request-event.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"state": "opened",
5353
"blocking_discussions_resolved": true,
5454
"work_in_progress": false,
55+
"draft": false,
5556
"first_contribution": true,
5657
"merge_status": "unchecked",
5758
"target_project_id": 14,
@@ -137,6 +138,10 @@
137138
"previous": null,
138139
"current": 1
139140
},
141+
"draft": {
142+
"previous": true,
143+
"current": false
144+
},
140145
"updated_at": {
141146
"previous": "2017-09-15 16:50:55 UTC",
142147
"current":"2017-09-15 16:52:00 UTC"
@@ -192,4 +197,4 @@
192197
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
193198
}
194199
]
195-
}
200+
}

0 commit comments

Comments
 (0)