worflow-pr: wip

This commit is contained in:
Adam Majer 2024-12-02 10:26:51 +01:00
parent 2d12899da5
commit 0c866e8f89
5 changed files with 24 additions and 7 deletions

View File

@ -362,7 +362,8 @@ func processPullNotification(gitea common.Gitea, thread *models.NotificationThre
} }
}() }()
git, err := common.CreateGitHandler(GitAuthor, "noaddress@suse.de", BotName) gh := common.GitHandlerImpl{}
git, err := gh.CreateGitHandler(GitAuthor, "noaddress@suse.de", BotName)
if err != nil { if err != nil {
log.Panicln(err) log.Panicln(err)
} }

View File

@ -64,13 +64,14 @@ prjMaintainer:
func CheckIfMaintainersApproved(gitea GiteaMaintainershipInterface, config common.AutogitConfig, prjGitPRNumber int64) (bool, error) { func CheckIfMaintainersApproved(gitea GiteaMaintainershipInterface, config common.AutogitConfig, prjGitPRNumber int64) (bool, error) {
gitea.GetPullRequestAndReviews(config.Organization, config.GitProjectName, prjGitPRNumber) gitea.GetPullRequestAndReviews(config.Organization, config.GitProjectName, prjGitPRNumber)
gitea.FetchMaintainershipFile(config.Organization, config.GitProjectName, config.Branch) data, _ := gitea.FetchMaintainershipFile(config.Organization, config.GitProjectName, config.Branch)
parseMaintainershipData(data)
/* /*
pr, reviews, _ := gitea.GetPullRequestAndReviews(config.Organization, config.GitProjectName, prjGitPRNumber) pr, reviews, _ := gitea.GetPullRequestAndReviews(config.Organization, config.GitProjectName, prjGitPRNumber)
data, _ := gitea.FetchMaintainershipFile(config.Organization, config.GitProjectName, config.Branch) data, _ := gitea.FetchMaintainershipFile(config.Organization, config.GitProjectName, config.Branch)
maintainers, _ := parseMaintainershipData(data) maintainers, _ := parseMaintainershipData(data)
*/ */
return false, nil return false, nil
} }

5
workflow-pr/pr.go Normal file
View File

@ -0,0 +1,5 @@
package main
//go:generate mockgen -source=pr.go -destination=mock/pr.go -typed

View File

@ -1,6 +1,6 @@
package main package main
//go:generate mockgen -source=pr.go -destination=mock/pr.go -typed //go:generate mockgen -source=pr_processor.go -destination=mock/pr_processor.go -typed
import ( import (
"fmt" "fmt"

10
workflow-pr/pr_test.go Normal file
View File

@ -0,0 +1,10 @@
package main
import "testing"
func TestPR(t *testing.T) {
t.Run("Test simple PR to PrjGit checkout", func(t *testing.T) {
})
}