Merge remote-tracking branch 'gitea/main'

This commit is contained in:
2025-04-04 13:06:28 +02:00
3 changed files with 58 additions and 23 deletions

View File

@@ -34,6 +34,7 @@ import (
apiclient "src.opensuse.org/autogits/common/gitea-generated/client"
"src.opensuse.org/autogits/common/gitea-generated/client/notification"
"src.opensuse.org/autogits/common/gitea-generated/client/organization"
"src.opensuse.org/autogits/common/gitea-generated/client/issue"
"src.opensuse.org/autogits/common/gitea-generated/client/repository"
"src.opensuse.org/autogits/common/gitea-generated/client/user"
"src.opensuse.org/autogits/common/gitea-generated/models"
@@ -63,6 +64,10 @@ const (
ReviewStateUnknown models.ReviewStateType = ""
)
type GiteaComment interface {
AddComment(pr *models.PullRequest, comment string) (error)
}
type GiteaMaintainershipReader interface {
FetchMaintainershipFile(org, prjGit, branch string) ([]byte, string, error)
FetchMaintainershipDirFile(org, prjGit, branch, pkg string) ([]byte, string, error)
@@ -100,6 +105,7 @@ type GiteaRepoFetcher interface {
}
type Gitea interface {
GiteaComment
GiteaRepoFetcher
GiteaReviewRequester
GiteaReviewer
@@ -459,8 +465,15 @@ func (gitea *GiteaTransport) AddReviewComment(pr *models.PullRequest, state mode
transport.DefaultAuthentication,
)
*/
if err != nil {
return nil, err
}
/* c, err := client.Issue.IssueCreateComment(
return c.Payload, nil
}
func (gitea *GiteaTransport) AddComment(pr *models.PullRequest, comment string) (error) {
_, err := gitea.client.Issue.IssueCreateComment(
issue.NewIssueCreateCommentParams().
WithDefaults().
WithOwner(pr.Base.Repo.Owner.UserName).
@@ -469,13 +482,13 @@ func (gitea *GiteaTransport) AddReviewComment(pr *models.PullRequest, state mode
WithBody(&models.CreateIssueCommentOption{
Body: &comment,
}),
transport.DefaultAuthentication)
*/
gitea.transport.DefaultAuthentication)
if err != nil {
return nil, err
return err
}
return c.Payload, nil
return nil
}
func (gitea *GiteaTransport) GetRepositoryFileContent(org, repo, hash, path string) ([]byte, string, error) {