mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-04-15 01:41:56 +00:00
Do not store inactive repos (#1658)
Do not sync repos with forge if the repo is not necessary in DB. In the DB, only repos that were active once or repos that are currently active are stored. When trying to enable new repos, the repos list is fetched from the forge instead and displayed directly. In addition to this, the forge func `Perm` was removed and is now merged with `Repo`. Solves a TODO on RepoBatch. --------- Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
@@ -209,16 +209,6 @@ func (c *client) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error
|
||||
return repos, nil
|
||||
}
|
||||
|
||||
// Perm returns the user permissions for the named GitHub repository.
|
||||
func (c *client) Perm(ctx context.Context, u *model.User, r *model.Repo) (*model.Perm, error) {
|
||||
client := c.newClientToken(ctx, u.Token)
|
||||
repo, _, err := client.Repositories.Get(ctx, r.Owner, r.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return convertPerm(repo.GetPermissions()), nil
|
||||
}
|
||||
|
||||
// File fetches the file from the GitHub repository and returns its contents.
|
||||
func (c *client) File(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]byte, error) {
|
||||
client := c.newClientToken(ctx, u.Token)
|
||||
|
||||
Reference in New Issue
Block a user