From 2b8a129948e11fa0074eee647fdb7ca76d788a77 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Wed, 12 Sep 2018 00:42:48 +0200 Subject: [PATCH] feat: parse labels & assignees from both GitHub and GitLab --- issue.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/issue.go b/issue.go index 4c8a8afef..4e8a5ed41 100644 --- a/issue.go +++ b/issue.go @@ -77,6 +77,18 @@ func FromGitHubIssue(input *github.Issue) *Issue { Labels: make([]*IssueLabel, 0), Assignees: make([]*Profile, 0), } + for _, label := range input.Labels { + issue.Labels = append(issue.Labels, &IssueLabel{ + Name: *label.Name, + Color: *label.Color, + }) + } + for _, assignee := range input.Assignees { + issue.Assignees = append(issue.Assignees, &Profile{ + Name: *assignee.Name, + Username: *assignee.Login, + }) + } return issue } @@ -93,6 +105,18 @@ func FromGitLabIssue(input *gitlab.Issue) *Issue { Labels: make([]*IssueLabel, 0), Assignees: make([]*Profile, 0), } + for _, label := range input.Labels { + issue.Labels = append(issue.Labels, &IssueLabel{ + Name: label, + Color: "cccccc", + }) + } + for _, assignee := range input.Assignees { + issue.Assignees = append(issue.Assignees, &Profile{ + Name: assignee.Name, + Username: assignee.Username, + }) + } return issue }