Open
Description
we know go-scm
can work well with Drone, and it can use repo.Find
interface to find a specific project.
In our scenario, we hope can use string to search the project list, so whether we can add a search interface for go-scm
,
interface
# https://github.com/go-atomci/go-scm/blob/master/scm/search.go#L16
SearchService interface {
// Find returns a repository by name.
FindProjects(context.Context, string) ([]*Repository, *Response, error)
}
gitlab sample
# gitlab
# https://github.com/go-atomci/go-scm/blob/master/scm/driver/gitlab/search.go#L18
func (s *searchService) FindProjects(ctx context.Context, projectName string) ([]*scm.Repository, *scm.Response, error) {
path := fmt.Sprintf("api/v4/search?scope=projects&search=%s", encode(projectName))
out := []*repository{}
res, err := s.client.do(ctx, "GET", path, nil, &out)
return convertRepositoryList(out), res, err
}
Metadata
Metadata
Assignees
Labels
No labels