Skip to content

Commit

Permalink
[feat]: [CDS-73572]: review comments in corporated
Browse files Browse the repository at this point in the history
  • Loading branch information
adivishy1 committed Jul 19, 2023
1 parent 959d91f commit e325dd3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
14 changes: 1 addition & 13 deletions scm/driver/github/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (s *RepositoryService) ListV2(ctx context.Context, opts scm.RepoListOptions
path := fmt.Sprintf("search/repositories?%s", formRepoListQueryParams(opts))
out := new(searchRepositoryList)
res, err := s.client.do(ctx, "GET", path, nil, &out)
return convertSearchRepositoryList(out), res, err
return convertRepositoryList(out.Repositories), res, err
}

// List returns the github app installation repository list.
Expand Down Expand Up @@ -234,18 +234,6 @@ func convertRepositoryList(from []*repository) []*scm.Repository {
return to
}

// helper function to convert from the gogs items list to
// the common repository structure.
func convertSearchRepositoryList(from *searchRepositoryList) []*scm.Repository {
to := []*scm.Repository{}
for _, v := range from.Repositories {
if repo := convertRepository(v); repo != nil {
to = append(to, repo)
}
}
return to
}

// helper function to convert from the gogs repository structure
// to the common repository structure.
func convertRepository(from *repository) *scm.Repository {
Expand Down
1 change: 1 addition & 0 deletions scm/driver/gitlab/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func (s *repositoryService) List(ctx context.Context, opts scm.ListOptions) ([]*
}

func (s *repositoryService) ListV2(ctx context.Context, opts scm.RepoListOptions) ([]*scm.Repository, *scm.Response, error) {
// We pass the repo searchTerm in the query params and gitlab filters repos based on this search term
path := fmt.Sprintf("api/v4/projects?%s", encodeRepoMemberListOptions(opts))
out := []*repository{}
res, err := s.client.do(ctx, "GET", path, nil, &out)
Expand Down

0 comments on commit e325dd3

Please sign in to comment.