File tree Expand file tree Collapse file tree 10 files changed +77
-5
lines changed Expand file tree Collapse file tree 10 files changed +77
-5
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,10 @@ type pr struct {
95
95
Merged bool `json:"merged"`
96
96
Created time.Time `json:"created_at"`
97
97
Updated time.Time `json:"updated_at"`
98
+ Labels []struct {
99
+ Name string `json:"name"`
100
+ Color string `json:"color"`
101
+ } `json:"labels"`
98
102
}
99
103
100
104
type reference struct {
@@ -123,6 +127,13 @@ func convertPullRequests(src []*pr) []*scm.PullRequest {
123
127
}
124
128
125
129
func convertPullRequest (src * pr ) * scm.PullRequest {
130
+ var labels []scm.Label
131
+ for _ , label := range src .Labels {
132
+ labels = append (labels , scm.Label {
133
+ Name : label .Name ,
134
+ Color : label .Color ,
135
+ })
136
+ }
126
137
return & scm.PullRequest {
127
138
Number : src .Number ,
128
139
Title : src .Title ,
@@ -138,6 +149,7 @@ func convertPullRequest(src *pr) *scm.PullRequest {
138
149
Merged : src .Merged ,
139
150
Created : src .Created ,
140
151
Updated : src .Updated ,
152
+ Labels : labels ,
141
153
}
142
154
}
143
155
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ type pr struct {
96
96
MergedAt null.String `json:"merged_at"`
97
97
CreatedAt time.Time `json:"created_at"`
98
98
UpdatedAt time.Time `json:"updated_at"`
99
+ Labels []struct {
100
+ Name string `json:"name"`
101
+ Color string `json:"color"`
102
+ } `json:"labels"`
99
103
}
100
104
101
105
type prInput struct {
@@ -123,6 +127,13 @@ func convertPullRequestList(from []*pr) []*scm.PullRequest {
123
127
}
124
128
125
129
func convertPullRequest (from * pr ) * scm.PullRequest {
130
+ var labels []scm.Label
131
+ for _ , label := range from .Labels {
132
+ labels = append (labels , scm.Label {
133
+ Name : label .Name ,
134
+ Color : label .Color ,
135
+ })
136
+ }
126
137
return & scm.PullRequest {
127
138
Number : from .Number ,
128
139
Title : from .Title ,
@@ -151,6 +162,7 @@ func convertPullRequest(from *pr) *scm.PullRequest {
151
162
},
152
163
Created : from .CreatedAt ,
153
164
Updated : from .UpdatedAt ,
165
+ Labels : labels ,
154
166
}
155
167
}
156
168
Original file line number Diff line number Diff line change 55
55
"node_id" : " MDU6TGFiZWw2MzA2MzQ4MA==" ,
56
56
"url" : " https://api.github.com/repos/bradrydzewski/drone-test-go/labels/bug" ,
57
57
"name" : " bug" ,
58
+ "color" : " fc2927" ,
59
+ "default" : true
60
+ },
61
+ {
62
+ "id" : 63063480 ,
63
+ "node_id" : " MDU6TGFiZWw2MzA2MzQ4MA==" ,
64
+ "url" : " https://api.github.com/repos/bradrydzewski/drone-test-go/labels/bug" ,
65
+ "name" : " documentation" ,
58
66
"color" : " fc2929" ,
59
67
"default" : true
60
68
}
Original file line number Diff line number Diff line change 42
42
"Avatar": "https://avatars1.githubusercontent.com/u/817538?v=4"
43
43
},
44
44
"Created": "2018-06-22T23:54:09Z",
45
- "Updated": "2018-06-25T19:05:03Z"
45
+ "Updated": "2018-06-25T19:05:03Z",
46
+ "labels": [
47
+ {
48
+ "name": "bug",
49
+ "color": "fc2927"
50
+ },
51
+ {
52
+ "name": "documentation",
53
+ "color": "fc2929"
54
+ }
55
+ ]
46
56
},
47
57
"Sender": {
48
58
"Login": "bradrydzewski",
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ type pr struct {
109
109
Created time.Time `json:"created_at"`
110
110
Updated time.Time `json:"updated_at"`
111
111
Closed time.Time
112
+ Labels []string `json:"labels"`
112
113
}
113
114
114
115
type changes struct {
@@ -132,6 +133,12 @@ func convertPullRequestList(from []*pr) []*scm.PullRequest {
132
133
}
133
134
134
135
func convertPullRequest (from * pr ) * scm.PullRequest {
136
+ var labels []scm.Label
137
+ for _ , label := range from .Labels {
138
+ labels = append (labels , scm.Label {
139
+ Name : label ,
140
+ })
141
+ }
135
142
return & scm.PullRequest {
136
143
Number : from .Number ,
137
144
Title : from .Title ,
@@ -150,6 +157,7 @@ func convertPullRequest(from *pr) *scm.PullRequest {
150
157
},
151
158
Created : from .Created ,
152
159
Updated : from .Updated ,
160
+ Labels : labels ,
153
161
}
154
162
}
155
163
Original file line number Diff line number Diff line change 22
22
"assignee" : null ,
23
23
"source_project_id" : 32732 ,
24
24
"target_project_id" : 32732 ,
25
- "labels" : [],
25
+ "labels" : [" bug " , " documentation " ],
26
26
"work_in_progress" : false ,
27
27
"milestone" : null ,
28
28
"merge_when_pipeline_succeeds" : false ,
Original file line number Diff line number Diff line change 16
16
"Avatar": "https://secure.gravatar.com/avatar/b5bf44866b4eeafa2d8114bfe15da02f?s=80\u0026d=identicon"
17
17
},
18
18
"Created": "2015-12-18T18:29:53.563Z",
19
- "Updated": "2015-12-18T18:30:22.522Z"
19
+ "Updated": "2015-12-18T18:30:22.522Z",
20
+ "Labels": [
21
+ {
22
+ "name": "bug"
23
+ },
24
+ {
25
+ "name": "documentation"
26
+ }
27
+ ]
20
28
}
Original file line number Diff line number Diff line change 23
23
"assignee" : null ,
24
24
"source_project_id" : 32732 ,
25
25
"target_project_id" : 32732 ,
26
- "labels" : [],
26
+ "labels" : [" bug " , " documentation " ],
27
27
"work_in_progress" : false ,
28
28
"milestone" : null ,
29
29
"merge_when_pipeline_succeeds" : false ,
Original file line number Diff line number Diff line change 17
17
"Avatar": "https://secure.gravatar.com/avatar/b5bf44866b4eeafa2d8114bfe15da02f?s=80\u0026d=identicon"
18
18
},
19
19
"Created": "2015-12-18T18:29:53.563Z",
20
- "Updated": "2015-12-18T18:30:22.522Z"
20
+ "Updated": "2015-12-18T18:30:22.522Z",
21
+ "Labels": [
22
+ {
23
+ "name": "bug"
24
+ },
25
+ {
26
+ "name": "documentation"
27
+ }
28
+ ]
21
29
}
22
30
]
Original file line number Diff line number Diff line change 28
28
Author User
29
29
Created time.Time
30
30
Updated time.Time
31
+ Labels []Label
31
32
}
32
33
33
34
// PullRequestInput provides the input fields required for creating a pull request.
@@ -55,6 +56,11 @@ type (
55
56
Deleted bool
56
57
}
57
58
59
+ Label struct {
60
+ Name string
61
+ Color string
62
+ }
63
+
58
64
// PullRequestService provides access to pull request resources.
59
65
PullRequestService interface {
60
66
// Find returns the repository pull request by number.
You can’t perform that action at this time.
0 commit comments