Skip to content

Commit 1ccff59

Browse files
committed
Add color field to label struct
1 parent 23aa7d5 commit 1ccff59

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

scm/driver/gitea/pr.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ type pr struct {
9696
Created time.Time `json:"created_at"`
9797
Updated time.Time `json:"updated_at"`
9898
Labels []struct {
99-
Name string `json:"name"`
99+
Name string `json:"name"`
100+
Color string `json:"color"`
100101
} `json:"labels"`
101102
}
102103

@@ -129,7 +130,8 @@ func convertPullRequest(src *pr) *scm.PullRequest {
129130
var labels []scm.Label
130131
for _, label := range src.Labels {
131132
labels = append(labels, scm.Label{
132-
Name: label.Name,
133+
Name: label.Name,
134+
Color: label.Color,
133135
})
134136
}
135137
return &scm.PullRequest{

scm/driver/github/pr.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ type pr struct {
9797
CreatedAt time.Time `json:"created_at"`
9898
UpdatedAt time.Time `json:"updated_at"`
9999
Labels []struct {
100-
Name string `json:"name"`
100+
Name string `json:"name"`
101+
Color string `json:"color"`
101102
} `json:"labels"`
102103
}
103104

@@ -129,7 +130,8 @@ func convertPullRequest(from *pr) *scm.PullRequest {
129130
var labels []scm.Label
130131
for _, label := range from.Labels {
131132
labels = append(labels, scm.Label{
132-
Name: label.Name,
133+
Name: label.Name,
134+
Color: label.Color,
133135
})
134136
}
135137
return &scm.PullRequest{

scm/driver/github/testdata/webhooks/pr_labeled.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"node_id": "MDU6TGFiZWw2MzA2MzQ4MA==",
5656
"url": "https://api.github.com/repos/bradrydzewski/drone-test-go/labels/bug",
5757
"name": "bug",
58-
"color": "fc2929",
58+
"color": "fc2927",
5959
"default": true
6060
},
6161
{

scm/driver/github/testdata/webhooks/pr_labeled.json.golden

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@
4545
"Updated": "2018-06-25T19:05:03Z",
4646
"labels": [
4747
{
48-
"name": "bug"
48+
"name": "bug",
49+
"color": "fc2927"
4950
},
5051
{
51-
"name": "documentation"
52+
"name": "documentation",
53+
"color": "fc2929"
5254
}
5355
]
5456
},

scm/pr.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ type (
5757
}
5858

5959
Label struct {
60-
Name string
60+
Name string
61+
Color string
6162
}
6263

6364
// PullRequestService provides access to pull request resources.

0 commit comments

Comments
 (0)