Skip to content

Commit

Permalink
Finished circleci provider list project
Browse files Browse the repository at this point in the history
  • Loading branch information
futugyou committed Oct 17, 2024
1 parent 52847e8 commit 80b9123
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions infr-project/platform_provider/circleci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 80b9123

Please sign in to comment.