1
0
Fork 0
forked from forgejo/forgejo

Bump google/go-github to v57 (#28514)

This commit is contained in:
Yevhen Pavlov 2023-12-18 23:42:04 +02:00 committed by GitHub
parent 4ea522fecf
commit cd2ff6e83d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 12 deletions

View file

@ -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") {