From 1d6d5f44688c92c1b469ae3374762cc03a32a097 Mon Sep 17 00:00:00 2001 From: Marco Bersani Date: Fri, 26 Jan 2024 17:03:15 +0100 Subject: [PATCH] Improve gitlab provider label generation Signed-off-by: Marco Bersani --- internal/providers/gitlab/root.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/providers/gitlab/root.go b/internal/providers/gitlab/root.go index 34c7796..f046055 100644 --- a/internal/providers/gitlab/root.go +++ b/internal/providers/gitlab/root.go @@ -104,9 +104,16 @@ func (c *Client) makeProjects(projects []*gitlab.Project) []project.Project { for i, proj := range projects { labels := make(map[string]string) for _, topic := range proj.Topics { - if split := strings.Split(topic, ": "); len(split) > 1 { - labels[split[0]] = split[1] + split := strings.Split(topic, ":") + + key := strings.Trim(split[0], " ") + if len(split) == 1 { + labels[key] = "true" + continue } + + value := strings.Trim(split[1], " ") + labels[key] = value } result[i] = project.Project{