2024-07-07 21:08:41 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"src.opensuse.org/autogits/common"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
ListenPort = 8001
|
|
|
|
ListenAddr = "[::1]"
|
|
|
|
|
|
|
|
GitAuthor = "GiteaBot - AutoStaging"
|
2024-07-09 12:06:24 +02:00
|
|
|
PrReview = "pr-review"
|
2024-07-07 21:08:41 +02:00
|
|
|
)
|
|
|
|
|
2024-07-09 12:06:24 +02:00
|
|
|
func processPullRequest(h *common.RequestHandler) error {
|
|
|
|
req := h.Data.(common.PullRequestAction)
|
|
|
|
|
|
|
|
// requests against project are not handled here
|
|
|
|
if req.Repository.Name == common.DefaultGitPrj {
|
|
|
|
return nil
|
2024-07-07 21:08:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2024-07-09 12:06:24 +02:00
|
|
|
var defs common.ListenDefinitions
|
2024-07-07 21:08:41 +02:00
|
|
|
|
2024-07-09 12:06:24 +02:00
|
|
|
defs.Url = PrReview
|
|
|
|
defs.GitAuthor = GitAuthor
|
2024-07-09 15:05:49 +02:00
|
|
|
|
|
|
|
defs.Handlers=make(map[string]common.RequestProcessor)
|
2024-07-09 12:06:24 +02:00
|
|
|
defs.Handlers[common.RequestType_PR] = processPullRequest
|
2024-07-07 21:08:41 +02:00
|
|
|
|
2024-07-09 12:06:24 +02:00
|
|
|
common.RequireGiteaSecretToken()
|
|
|
|
common.RequireObsSecretToken()
|
|
|
|
common.StartServer(defs)
|
2024-07-07 21:08:41 +02:00
|
|
|
}
|