Skip to content

Commit

Permalink
feat: add draft to gitlab merge-request-event payload (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
xNok authored Jul 30, 2024
1 parent 2fe5d09 commit 02d182a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
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"
}
]
}
}

0 comments on commit 02d182a

Please sign in to comment.