@ -21,7 +21,7 @@ import (
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/util"
"github.com/google/go-github/v39 /github"
"github.com/google/go-github/v45 /github"
"golang.org/x/oauth2"
"golang.org/x/oauth2"
)
)
@ -778,6 +778,7 @@ func (g *GithubDownloaderV3) GetReviews(reviewable base.Reviewable) ([]*base.Rev
opt := & github . ListOptions {
opt := & github . ListOptions {
PerPage : g . maxPerPage ,
PerPage : g . maxPerPage ,
}
}
// Get approve/request change reviews
for {
for {
g . waitAndPickClient ( )
g . waitAndPickClient ( )
reviews , resp , err := g . getClient ( ) . PullRequests . ListReviews ( g . ctx , g . repoOwner , g . repoName , int ( reviewable . GetForeignIndex ( ) ) , opt )
reviews , resp , err := g . getClient ( ) . PullRequests . ListReviews ( g . ctx , g . repoOwner , g . repoName , int ( reviewable . GetForeignIndex ( ) ) , opt )
@ -817,5 +818,28 @@ func (g *GithubDownloaderV3) GetReviews(reviewable base.Reviewable) ([]*base.Rev
}
}
opt . Page = resp . NextPage
opt . Page = resp . NextPage
}
}
// Get requested reviews
for {
g . waitAndPickClient ( )
reviewers , resp , err := g . getClient ( ) . PullRequests . ListReviewers ( g . ctx , g . repoOwner , g . repoName , int ( reviewable . GetForeignIndex ( ) ) , opt )
if err != nil {
return nil , fmt . Errorf ( "error while listing repos: %v" , err )
}
g . setRate ( & resp . Rate )
for _ , user := range reviewers . Users {
r := & base . Review {
ReviewerID : user . GetID ( ) ,
ReviewerName : user . GetLogin ( ) ,
State : base . ReviewStateRequestReview ,
IssueIndex : reviewable . GetLocalIndex ( ) ,
}
allReviews = append ( allReviews , r )
}
// TODO: Handle Team requests
if resp . NextPage == 0 {
break
}
opt . Page = resp . NextPage
}
return allReviews , nil
return allReviews , nil
}
}