staging: fixes

This commit is contained in:
2025-05-04 20:45:33 +02:00
parent 62a597718b
commit 0d0fcef7ac
4 changed files with 64 additions and 15 deletions

View File

@@ -85,13 +85,19 @@ type GiteaReviewFetcher interface {
GetPullRequestReviews(org, project string, PRnum int64) ([]*models.PullReview, error)
}
type GiteaCommentFetcher interface {
GetIssueComments(org, project string, issueNo int64) ([]*models.Comment, error)
}
type GiteaPRChecker interface {
GiteaReviewFetcher
GiteaCommentFetcher
GiteaMaintainershipReader
}
type GiteaReviewFetcherAndRequester interface {
GiteaReviewFetcher
GiteaCommentFetcher
GiteaReviewRequester
}
@@ -139,6 +145,7 @@ type Gitea interface {
GiteaReviewer
GiteaPRFetcher
GiteaReviewFetcher
GiteaCommentFetcher
GiteaMaintainershipReader
GiteaFileContentReader
@@ -242,6 +249,30 @@ func (gitea *GiteaTransport) GetPullRequestReviews(org, project string, PRnum in
return allReviews, nil
}
func (gitea *GiteaTransport) GetIssueComments(org, project string, issueNo int64) ([]*models.Comment, error) {
// limit := int64(20)
// var page int64
// var allComments []*models.Comment
// for {
c, err := gitea.client.Issue.IssueGetComments(
issue.NewIssueGetCommentsParams().
WithDefaults().
WithOwner(org).
WithRepo(project).
WithIndex(issueNo),
gitea.transport.DefaultAuthentication)
if err != nil {
return nil, err
}
return c.Payload, nil
// if len(c.Payload) < int(limit)
// }
}
func (gitea *GiteaTransport) GetPullNotifications(since *time.Time) ([]*models.NotificationThread, error) {
bigLimit := int64(100000)
@@ -618,13 +649,13 @@ func (gitea *GiteaTransport) GetRecentCommits(org, repo, branch string, commitNo
not := false
var page int64 = 1
params := repository.NewRepoGetAllCommitsParams().
WithOwner(org).
WithRepo(repo).
WithPage(&page).
WithStat(&not).
WithFiles(&not).
WithVerification(&not).
WithLimit(&commitNo)
WithOwner(org).
WithRepo(repo).
WithPage(&page).
WithStat(&not).
WithFiles(&not).
WithVerification(&not).
WithLimit(&commitNo)
if len(branch) > 0 {
params = params.WithSha(&branch)