From a99b1f4f9ea96b7c9267af41a8d30375116fe02e Mon Sep 17 00:00:00 2001 From: Izimic Date: Fri, 27 Nov 2020 16:59:17 +0100 Subject: [PATCH] payload.json --- src/webhooksd.cr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/webhooksd.cr b/src/webhooksd.cr index b5f9827..d88dc50 100644 --- a/src/webhooksd.cr +++ b/src/webhooksd.cr @@ -46,6 +46,7 @@ OptionParser.parse do |parser| end scriptfile = "on-push" +jsonfile = "payload.json" server = HTTP::Server.new do |context| if context.request.method != "POST" || context.request.path != "/" @@ -55,6 +56,7 @@ server = HTTP::Server.new do |context| path_project = storage + "/" + payload.project path_scriptfile = path_project + "/" + scriptfile + path_jsonfile = path_project + "/" + jsonfile status = false @@ -66,11 +68,13 @@ server = HTTP::Server.new do |context| STDERR.puts "ERROR: Scriptfile not found" status = false else - context.response.content_type = "text/plain" + File.write(path_jsonfile, payload.content) status = Process.run command: "sh", args: [scriptfile], shell: true, error: STDERR, output: STDOUT, chdir: path_project end end + + context.response.content_type = "text/plain" if status context.response.print "SUCCESS" else