Skip to content

Commit

Permalink
Merge pull request jenkins-x#110 from abayer/support-gitlab-wip-as-draft
Browse files Browse the repository at this point in the history
fix: Use GitLab's work-in-progress as draft value
  • Loading branch information
jenkins-x-bot authored Apr 27, 2020
2 parents 4bd1f85 + 78c6ca8 commit eaeb89a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions scm/driver/gitlab/pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ type pr struct {
State string `json:"state"`
Labels []*string `json:"labels"`
Link string `json:"web_url"`
WIP bool `json:"work_in_progress"`
Author struct {
Username string `json:"username"`
Email string `json:"email"`
Expand Down Expand Up @@ -311,6 +312,7 @@ func convertPullRequest(from *pr) *scm.PullRequest {
Source: from.SourceBranch,
Target: from.TargetBranch,
Link: from.Link,
Draft: from.WIP,
Closed: from.State != "opened",
Merged: from.State == "merged",
Mergeable: scm.ToMergeableState(from.MergeStatus) == scm.MergeableStateMergeable,
Expand Down
4 changes: 2 additions & 2 deletions scm/driver/gitlab/testdata/merge.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"source_project_id": 32732,
"target_project_id": 32732,
"labels": [],
"work_in_progress": false,
"work_in_progress": true,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
Expand All @@ -44,4 +44,4 @@
},
"subscribed": false,
"changes_count": null
}
}
1 change: 1 addition & 0 deletions scm/driver/gitlab/testdata/merge.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"Merged": false,
"Mergeable": true,
"MergeableState": "mergeable",
"Draft": true,
"Author": {
"Login": "dblessing",
"Name": "Drew Blessing",
Expand Down

0 comments on commit eaeb89a

Please sign in to comment.