From 482ddc7c57af56303f9bed785052f387302aa4a9 Mon Sep 17 00:00:00 2001 From: Enrico Fasoli Date: Sat, 25 Apr 2015 14:58:20 +0200 Subject: [PATCH] fixed github integration --- bin/hubot | 2 +- scripts/github.coffee | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/hubot b/bin/hubot index 9488e9b..2527054 100755 --- a/bin/hubot +++ b/bin/hubot @@ -5,4 +5,4 @@ set -e PYTHON=python2 npm install export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH" -DEBUG=nightmare PYTHON=python2 BIND_ADDRESS=localhost node_modules/.bin/hubot --name "asjon" --alias "assa" "$@" +DEBUG=nightmare PYTHON=python2 node_modules/.bin/hubot --name "asjon" --alias "assa" "$@" diff --git a/scripts/github.coffee b/scripts/github.coffee index c03246f..9f334dd 100644 --- a/scripts/github.coffee +++ b/scripts/github.coffee @@ -4,6 +4,13 @@ module.exports = (robot) -> robot.router.post '/hubot/githubhook/:room', (req, res) -> res.send 200 + if !process.env.GITHUB_API_SECRET + console.log 'non sono configurato per GITHUB API WEBHOOKS!' + return + else if process.env.GITHUB_API_SECRET isnt req.headers["X-Hub-Signature"] + console.log 'MALFORMED GITHUB API SECRET: was', + req.headers["X-Hub-Signature"], 'but expected', process.env.GITHUB_API_SECRET + return console.log req.body robot.send req.params.room, JSON.stringify req.body if req.body.ref is 'refs/head/master'