Skip to content

Commit

Permalink
feat: parse labels & assignees from both GitHub and GitLab
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Sep 11, 2018
1 parent e057fe6 commit 2b8a129
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down

0 comments on commit 2b8a129

Please sign in to comment.