From 80b9123655e17fa73011688ab4356945f7adfd8d Mon Sep 17 00:00:00 2001 From: futugyou <17871902+futugyou@users.noreply.github.com> Date: Thu, 17 Oct 2024 16:14:37 +0800 Subject: [PATCH] Finished circleci provider list project --- infr-project/platform_provider/circleci.go | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/infr-project/platform_provider/circleci.go b/infr-project/platform_provider/circleci.go index d614a178..b7495521 100644 --- a/infr-project/platform_provider/circleci.go +++ b/infr-project/platform_provider/circleci.go @@ -96,6 +96,31 @@ func (g *CircleClient) ListProjectAsync(ctx context.Context, filter ProjectFilte go func() { defer close(resultChan) defer close(errorChan) + + client, err := NewCircleClientV1(g.token) + if err != nil { + errorChan <- err + return + } + + circleciProjects, err := client.client.Project.ListProject() + if err != nil { + errorChan <- err + return + } + + projects := []Project{} + for _, pro := range circleciProjects { + if pro.Followed { + projects = append(projects, Project{ + ID: pro.Reponame, + Name: pro.Reponame, + Url: pro.VcsURL, + }) + } + } + + resultChan <- projects }() return resultChan, errorChan