.
This commit is contained in:
parent
96a07e95c7
commit
ef6fd8ee20
@ -9,6 +9,7 @@ import (
|
|||||||
const RequestType_Push = "push"
|
const RequestType_Push = "push"
|
||||||
const RequestType_Repository = "repository"
|
const RequestType_Repository = "repository"
|
||||||
const RequestType_PR = "pull_request"
|
const RequestType_PR = "pull_request"
|
||||||
|
const RequestType_PR_sync = "pull_request_sync"
|
||||||
|
|
||||||
type RequestProcessor func(*RequestHandler) error
|
type RequestProcessor func(*RequestHandler) error
|
||||||
|
|
||||||
@ -56,6 +57,8 @@ func StartServerWithAddress(listenDefs ListenDefinitions, addr string) {
|
|||||||
h.parsePushRequest(req.Body)
|
h.parsePushRequest(req.Body)
|
||||||
case RequestType_PR:
|
case RequestType_PR:
|
||||||
h.parsePullRequest(req.Body)
|
h.parsePullRequest(req.Body)
|
||||||
|
case RequestType_PR_sync:
|
||||||
|
h.parsePullRequestSync(req.Body)
|
||||||
default:
|
default:
|
||||||
h.LogError("Unhandled request type: %s", reqType)
|
h.LogError("Unhandled request type: %s", reqType)
|
||||||
res.WriteHeader(http.StatusInternalServerError)
|
res.WriteHeader(http.StatusInternalServerError)
|
||||||
|
@ -24,7 +24,7 @@ func processPullRequestSync(h *common.RequestHandler) error {
|
|||||||
|
|
||||||
// find prjgit pull request associated with this one
|
// find prjgit pull request associated with this one
|
||||||
h.GetAssociatedPrjGitPR(&req.Pull_Request)
|
h.GetAssociatedPrjGitPR(&req.Pull_Request)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ func processPullRequestOpened(h *common.RequestHandler) error {
|
|||||||
This commit was autocreated by %s
|
This commit was autocreated by %s
|
||||||
referencing
|
referencing
|
||||||
|
|
||||||
PullRequest: %s/%s#%d`, req.Repository.Owner.Username,
|
PullRequest: %s/%s#%d`, req.Repository.Owner.Username,
|
||||||
req.Repository.Name, GitAuthor, req.Repository.Name, req.Pull_Request.Number)
|
req.Repository.Name, GitAuthor, req.Repository.Name, req.Pull_Request.Number)
|
||||||
|
|
||||||
prjGit := h.CreateRepositoryIfNotExist(*req.Repository.Owner, common.DefaultGitPrj)
|
prjGit := h.CreateRepositoryIfNotExist(*req.Repository.Owner, common.DefaultGitPrj)
|
||||||
@ -99,6 +99,7 @@ func main() {
|
|||||||
|
|
||||||
defs.Handlers = make(map[string]common.RequestProcessor)
|
defs.Handlers = make(map[string]common.RequestProcessor)
|
||||||
defs.Handlers[common.RequestType_PR] = processPullRequest
|
defs.Handlers[common.RequestType_PR] = processPullRequest
|
||||||
|
defs.Handlers[common.RequestType_PR_sync] = processPullRequest
|
||||||
|
|
||||||
common.RequireGiteaSecretToken()
|
common.RequireGiteaSecretToken()
|
||||||
common.RequireObsSecretToken()
|
common.RequireObsSecretToken()
|
||||||
|
Loading…
Reference in New Issue
Block a user