common: parse all PR for associated PrjGit PR
we may have more than 1 page of PR to parse
This commit is contained in:
@@ -401,10 +401,10 @@ func (gitea *GiteaTransport) AddReviewComment(pr *models.PullRequest, state mode
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gitea *GiteaTransport) GetAssociatedPrjGitPR(pr *PullRequestWebhookEvent) (*models.PullRequest, error) {
|
func (gitea *GiteaTransport) GetAssociatedPrjGitPR(pr *PullRequestWebhookEvent) (*models.PullRequest, error) {
|
||||||
var page, maxSize int64
|
var page int64
|
||||||
page = 1
|
|
||||||
maxSize = 10000
|
|
||||||
state := "open"
|
state := "open"
|
||||||
|
for {
|
||||||
|
page++
|
||||||
prs, err := gitea.client.Repository.RepoListPullRequests(
|
prs, err := gitea.client.Repository.RepoListPullRequests(
|
||||||
repository.
|
repository.
|
||||||
NewRepoListPullRequestsParams().
|
NewRepoListPullRequestsParams().
|
||||||
@@ -412,7 +412,6 @@ func (gitea *GiteaTransport) GetAssociatedPrjGitPR(pr *PullRequestWebhookEvent)
|
|||||||
WithOwner(pr.Repository.Owner.Username).
|
WithOwner(pr.Repository.Owner.Username).
|
||||||
WithRepo(DefaultGitPrj).
|
WithRepo(DefaultGitPrj).
|
||||||
WithState(&state).
|
WithState(&state).
|
||||||
WithLimit(&maxSize).
|
|
||||||
WithPage(&page),
|
WithPage(&page),
|
||||||
gitea.transport.DefaultAuthentication)
|
gitea.transport.DefaultAuthentication)
|
||||||
|
|
||||||
@@ -434,6 +433,11 @@ func (gitea *GiteaTransport) GetAssociatedPrjGitPR(pr *PullRequestWebhookEvent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(prs.Payload) < 10 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user