From ef6fd8ee20f9fbd5fc9c2c35ff1e85133655403303e33678cf8491afb14c2898 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Wed, 10 Jul 2024 17:29:36 +0200 Subject: [PATCH] . --- bots-common/listen.go | 3 +++ pr-review/main.go | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bots-common/listen.go b/bots-common/listen.go index 0342def..846229c 100644 --- a/bots-common/listen.go +++ b/bots-common/listen.go @@ -9,6 +9,7 @@ import ( const RequestType_Push = "push" const RequestType_Repository = "repository" const RequestType_PR = "pull_request" +const RequestType_PR_sync = "pull_request_sync" type RequestProcessor func(*RequestHandler) error @@ -56,6 +57,8 @@ func StartServerWithAddress(listenDefs ListenDefinitions, addr string) { h.parsePushRequest(req.Body) case RequestType_PR: h.parsePullRequest(req.Body) + case RequestType_PR_sync: + h.parsePullRequestSync(req.Body) default: h.LogError("Unhandled request type: %s", reqType) res.WriteHeader(http.StatusInternalServerError) diff --git a/pr-review/main.go b/pr-review/main.go index cd17641..e9c2f17 100644 --- a/pr-review/main.go +++ b/pr-review/main.go @@ -24,7 +24,7 @@ func processPullRequestSync(h *common.RequestHandler) error { // find prjgit pull request associated with this one h.GetAssociatedPrjGitPR(&req.Pull_Request) - + return nil } @@ -43,7 +43,7 @@ func processPullRequestOpened(h *common.RequestHandler) error { This commit was autocreated by %s 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) prjGit := h.CreateRepositoryIfNotExist(*req.Repository.Owner, common.DefaultGitPrj) @@ -99,6 +99,7 @@ func main() { defs.Handlers = make(map[string]common.RequestProcessor) defs.Handlers[common.RequestType_PR] = processPullRequest + defs.Handlers[common.RequestType_PR_sync] = processPullRequest common.RequireGiteaSecretToken() common.RequireObsSecretToken()