diff --git a/container/webhook/root/webhook.js b/container/webhook/root/webhook.js index c429048734476c9b960dccdd3016bcd073933464..a47e7c272f19024ad66805c7f58624c2dc4570b1 100755 --- a/container/webhook/root/webhook.js +++ b/container/webhook/root/webhook.js @@ -50,6 +50,34 @@ handler.on('Merge Request Hook', function(event){ } }) + +handler.on('Note Hook', function(event){ + if(event.payload.action == "comment" && event.payload.comment.body == "/retest"){ + var msg = { + "new_refs" : { + "heads" : { + "master" : event.payload.pull_request.head.sha + } + }, + "branch" : event.payload.pull_request.base.ref, + "url" : event.payload.pull_request.base.repo.url, + "submit_command" : { + "pr_merge_reference_name" : event.payload.pull_request.merge_reference_name + } + } + console.log(msg) + + if(event.payload.pull_request.base.repo.url.startsWith("https://gitee.com/src-oepkgs/")){ + spawn('ruby', ['/js/src_oepkgs_pr_hook.rb', JSON.stringify(msg)]) + } else { + spawn('ruby', ['/js/pr_hook.rb', JSON.stringify(msg)]) + } + } + +}) + + + http.createServer(function(req, res){ handler(req, res, function(err){ res.statusCode = 404