wip
This commit is contained in:
@@ -32,7 +32,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
AppName = "workflow-pr"
|
||||
AppName = "workflow-pr"
|
||||
)
|
||||
|
||||
var GitAuthor string
|
||||
@@ -130,11 +130,6 @@ func main() {
|
||||
}
|
||||
common.LogInfo("Running with token from", CurrentUser.UserName)
|
||||
|
||||
req.Synced = &PullRequestSynced{}
|
||||
req.Opened = &PullRequestOpened{}
|
||||
req.Closed = &PullRequestClosed{}
|
||||
req.Review = &PullRequestReviewed{}
|
||||
|
||||
if *pr != "" {
|
||||
rx := regexp.MustCompile("^([a-zA-Z0-9_\\.-]+)/([a-zA-Z0-9_\\.-]+)#([0-9]+)$")
|
||||
if data := rx.FindStringSubmatch(*pr); data == nil {
|
||||
@@ -151,32 +146,12 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
if pr.State != "open" {
|
||||
common.LogError("Can only deal with open PRs. This one is", pr.State)
|
||||
return
|
||||
}
|
||||
|
||||
c := configs.GetPrjGitConfig(org, repo, pr.Base.Ref)
|
||||
if c == nil {
|
||||
if pr.Base.Repo.DefaultBranch == pr.Base.Ref {
|
||||
c = configs.GetPrjGitConfig(org, repo, "")
|
||||
}
|
||||
}
|
||||
if c == nil {
|
||||
common.LogError("Cannot find config for PR.")
|
||||
return
|
||||
}
|
||||
|
||||
git, err := GitHandler.CreateGitHandler(org)
|
||||
common.PanicOnError(err)
|
||||
defer git.Close()
|
||||
|
||||
p := common.PullRequestWebhookEvent{
|
||||
Action: "opened",
|
||||
Number: num,
|
||||
Pull_Request: common.PullRequestFromModel(pr),
|
||||
}
|
||||
if err = req.Opened.Process(&p, git, c); err != nil {
|
||||
if err = ProcesPullRequest(&p, configs); err != nil {
|
||||
common.LogError("processor returned error", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user