Skip to content

Commit

Permalink
feat(gitlab): skip archived repos (lindell#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
syphernl authored Mar 28, 2022
1 parent f99b8ed commit 10df83a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/scm/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,14 @@ func (g *Gitlab) getProjects(ctx context.Context) ([]*gitlab.Project, error) {
func (g *Gitlab) getGroupProjects(ctx context.Context, groupName string) ([]*gitlab.Project, error) {
var allProjects []*gitlab.Project
withMergeRequestsEnabled := true
archived := false
for i := 1; ; i++ {
projects, _, err := g.glClient.Groups.ListGroupProjects(groupName, &gitlab.ListGroupProjectsOptions{
ListOptions: gitlab.ListOptions{
PerPage: 100,
Page: i,
},
Archived: &archived,
IncludeSubgroups: &g.Config.IncludeSubgroups,
WithMergeRequestsEnabled: &withMergeRequestsEnabled,
}, gitlab.WithContext(ctx))
Expand Down Expand Up @@ -182,12 +184,14 @@ func (g *Gitlab) getProject(ctx context.Context, projRef ProjectReference) (*git

func (g *Gitlab) getUserProjects(ctx context.Context, username string) ([]*gitlab.Project, error) {
var allProjects []*gitlab.Project
archived := false
for i := 1; ; i++ {
projects, _, err := g.glClient.Projects.ListUserProjects(username, &gitlab.ListProjectsOptions{
ListOptions: gitlab.ListOptions{
PerPage: 100,
Page: i,
},
Archived: &archived,
}, gitlab.WithContext(ctx))
if err != nil {
return nil, err
Expand Down

0 comments on commit 10df83a

Please sign in to comment.