mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	Bump google/go-github to v57 (#28514)
This commit is contained in:
		@@ -7,7 +7,7 @@ package migrations
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
 | 
			
		||||
	"github.com/google/go-github/v53/github"
 | 
			
		||||
	"github.com/google/go-github/v57/github"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// ErrRepoNotCreated returns the error that repository not created
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@ import (
 | 
			
		||||
	"code.gitea.io/gitea/modules/proxy"
 | 
			
		||||
	"code.gitea.io/gitea/modules/structs"
 | 
			
		||||
 | 
			
		||||
	"github.com/google/go-github/v53/github"
 | 
			
		||||
	"github.com/google/go-github/v57/github"
 | 
			
		||||
	"golang.org/x/oauth2"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -135,7 +135,7 @@ func (g *GithubDownloaderV3) LogString() string {
 | 
			
		||||
func (g *GithubDownloaderV3) addClient(client *http.Client, baseURL string) {
 | 
			
		||||
	githubClient := github.NewClient(client)
 | 
			
		||||
	if baseURL != "https://github.com" {
 | 
			
		||||
		githubClient, _ = github.NewEnterpriseClient(baseURL, baseURL, client)
 | 
			
		||||
		githubClient, _ = github.NewClient(client).WithEnterpriseURLs(baseURL, baseURL)
 | 
			
		||||
	}
 | 
			
		||||
	g.clients = append(g.clients, githubClient)
 | 
			
		||||
	g.rates = append(g.rates, nil)
 | 
			
		||||
@@ -168,14 +168,14 @@ func (g *GithubDownloaderV3) waitAndPickClient() {
 | 
			
		||||
 | 
			
		||||
		err := g.RefreshRate()
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			log.Error("g.getClient().RateLimits: %s", err)
 | 
			
		||||
			log.Error("g.getClient().RateLimit.Get: %s", err)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RefreshRate update the current rate (doesn't count in rate limit)
 | 
			
		||||
func (g *GithubDownloaderV3) RefreshRate() error {
 | 
			
		||||
	rates, _, err := g.getClient().RateLimits(g.ctx)
 | 
			
		||||
	rates, _, err := g.getClient().RateLimit.Get(g.ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		// if rate limit is not enabled, ignore it
 | 
			
		||||
		if strings.Contains(err.Error(), "404") {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user