Skip to content

Commit

Permalink
Do not list archived repos for all forges (#2374)
Browse files Browse the repository at this point in the history
Bitbucket seems that does not support repository archiving.

Resolves: #2235

---------

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
  • Loading branch information
mzampetakis and qwerty287 authored Sep 6, 2023
1 parent 85e157b commit 8a517a8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions server/forge/gitea/gitea.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ func (c *Gitea) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error)
)
result := make([]*model.Repo, 0, len(repos))
for _, repo := range repos {
if repo.Archived {
continue
}
result = append(result, toRepo(repo))
}
return result, err
Expand Down
7 changes: 6 additions & 1 deletion server/forge/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@ func (c *client) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error
if err != nil {
return nil, err
}
repos = append(repos, convertRepoList(list)...)
for _, repo := range list {
if repo.GetArchived() {
continue
}
repos = append(repos, convertRepo(repo))
}
opts.Page = resp.NextPage
}
return repos, nil
Expand Down
1 change: 1 addition & 0 deletions server/forge/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func New(opts Opts) (forge.Forge, error) {
ClientID: opts.ClientID,
ClientSecret: opts.ClientSecret,
SkipVerify: opts.SkipVerify,
HideArchives: true,
}, nil
}

Expand Down

0 comments on commit 8a517a8

Please sign in to comment.