Split function & fix lint

This commit is contained in:
jaqra 2020-07-30 01:13:03 +03:00
parent 22cd08da7b
commit 9db8c10ff9
1 changed files with 20 additions and 14 deletions

View File

@ -65,20 +65,8 @@ func (ge *Gitea) Generate() (string, []Entry, error) {
for _, issue := range issues {
if issue != nil {
p := Entry{
Index: issue.Index,
Title: issue.Title,
}
labels := make([]Label, len(issue.Labels))
for idx, lbl := range issue.Labels {
labels[idx] = Label{
Name: lbl.Name,
}
}
p.Labels = labels
entries = append(entries, p)
entry := convertToEntiry(*issue)
entries = append(entries, entry)
}
}
@ -92,6 +80,24 @@ func (ge *Gitea) Generate() (string, []Entry, error) {
return tagURL, entries, nil
}
func convertToEntiry(issue gitea.Issue) Entry {
entry := Entry{
Index: issue.Index,
Title: issue.Title,
}
labels := make([]Label, len(issue.Labels))
for idx, lbl := range issue.Labels {
labels[idx] = Label{
Name: lbl.Name,
}
}
entry.Labels = labels
return entry
}
// Contributors returns a list of contributors from Gitea
func (ge *Gitea) Contributors() (ContributorList, error) {
client := gitea.NewClient(ge.BaseURL, ge.Token)