From 0567d5374d5771b4f251be073211036c1f729823 Mon Sep 17 00:00:00 2001 From: t3190102779 <3190102779@zju.edu.cn> Date: Tue, 19 Sep 2023 20:02:20 +0800 Subject: [PATCH 1/3] add comment /retest --- container/webhook/root/webhook.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/container/webhook/root/webhook.js b/container/webhook/root/webhook.js index c42904873..929cd2540 100755 --- a/container/webhook/root/webhook.js +++ b/container/webhook/root/webhook.js @@ -50,6 +50,32 @@ 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 -- Gitee From 2f582d745780cd0013b5471aa79d8338dfb34141 Mon Sep 17 00:00:00 2001 From: ydna0 Date: Tue, 19 Sep 2023 12:47:05 +0000 Subject: [PATCH 2/3] update container/webhook/root/webhook.js. Signed-off-by: ydna0 --- container/webhook/root/webhook.js | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/container/webhook/root/webhook.js b/container/webhook/root/webhook.js index 929cd2540..1e76c6c92 100755 --- a/container/webhook/root/webhook.js +++ b/container/webhook/root/webhook.js @@ -50,30 +50,7 @@ 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){ -- Gitee From 8693516400c976bdbd39f24c211e4ecd2ab53593 Mon Sep 17 00:00:00 2001 From: ydna0 Date: Tue, 19 Sep 2023 12:49:04 +0000 Subject: [PATCH 3/3] update container/webhook/root/webhook.js. Signed-off-by: ydna0 --- container/webhook/root/webhook.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/container/webhook/root/webhook.js b/container/webhook/root/webhook.js index 1e76c6c92..a47e7c272 100755 --- a/container/webhook/root/webhook.js +++ b/container/webhook/root/webhook.js @@ -51,6 +51,31 @@ 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){ -- Gitee