fixed github integration

This commit is contained in:
Enrico Fasoli 2015-04-25 14:58:20 +02:00
parent 3729e8e87e
commit 482ddc7c57
2 changed files with 8 additions and 1 deletions

View File

@ -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" "$@"

View File

@ -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'