Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add draft to gitlab merge-request-event payload #190

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion gitlab/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ type ObjectAttributes struct {
NoteableID int64 `json:"noteable_id"` // nolint: misspell
System bool `json:"system"`
WorkInProgress bool `json:"work_in_progress"`
Draft bool `json:"draft"`
StDiffs []StDiff `json:"st_diffs"`
Source Source `json:"source"`
Target Target `json:"target"`
Expand Down Expand Up @@ -880,14 +881,21 @@ type Author struct {
// Changes contains all changes associated with a GitLab issue or MR
type Changes struct {
LabelChanges LabelChanges `json:"labels"`
DraftChanges DraftChanges `json:"draft"`
}

// LabelChanges contains changes in labels assocatiated with a GitLab issue or MR
// LabelChanges contains changes in labels associated with a GitLab issue or MR
type LabelChanges struct {
Previous []Label `json:"previous"`
Current []Label `json:"current"`
}

// DraftChanges contains the current and previous value of the draft property, tells us if draft was toggles
type DraftChanges struct {
Previous bool `json:"previous"`
Current bool `json:"current"`
}

// Label contains all of the GitLab label information
type Label struct {
ID int64 `json:"id"`
Expand Down
7 changes: 6 additions & 1 deletion testdata/gitlab/merge-request-event.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"state": "opened",
"blocking_discussions_resolved": true,
"work_in_progress": false,
"draft": false,
"first_contribution": true,
"merge_status": "unchecked",
"target_project_id": 14,
Expand Down Expand Up @@ -137,6 +138,10 @@
"previous": null,
"current": 1
},
"draft": {
"previous": true,
"current": false
},
"updated_at": {
"previous": "2017-09-15 16:50:55 UTC",
"current":"2017-09-15 16:52:00 UTC"
Expand Down Expand Up @@ -192,4 +197,4 @@
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
}
]
}
}