fixato github del tutto SPERO
This commit is contained in:
parent
482ddc7c57
commit
53c247ae01
@ -2,20 +2,19 @@
|
|||||||
# interazioni tra asjon e github
|
# interazioni tra asjon e github
|
||||||
|
|
||||||
module.exports = (robot) ->
|
module.exports = (robot) ->
|
||||||
robot.router.post '/hubot/githubhook/:room', (req, res) ->
|
robot.router.post '/hubot/githubhook/:room/:name', (req, res) ->
|
||||||
res.send 200
|
res.send 200
|
||||||
if !process.env.GITHUB_API_SECRET
|
if !process.env.GITHUB_API_SECRET
|
||||||
console.log 'non sono configurato per GITHUB API WEBHOOKS!'
|
console.log 'non sono configurato per GITHUB API WEBHOOKS!'
|
||||||
return
|
return
|
||||||
else if process.env.GITHUB_API_SECRET isnt req.headers["X-Hub-Signature"]
|
else if "sha1="+process.env.GITHUB_API_SECRET isnt req.headers["x-hub-signature"]
|
||||||
console.log 'MALFORMED GITHUB API SECRET: was',
|
console.log 'MALFORMED GITHUB API SECRET: was',
|
||||||
req.headers["X-Hub-Signature"], 'but expected', process.env.GITHUB_API_SECRET
|
req.headers["x-hub-signature"], 'but expected', "sha1="+process.env.GITHUB_API_SECRET
|
||||||
return
|
return
|
||||||
console.log req.body
|
dest = name: req.params.name, room: req.params.room
|
||||||
robot.send req.params.room, JSON.stringify req.body
|
|
||||||
if req.body.ref is 'refs/head/master'
|
if req.body.ref is 'refs/head/master'
|
||||||
s = 'Sono stato aggiornato!\n'
|
s = 'Sono stato aggiornato!\n'
|
||||||
cm = req.body.commits.map (c) ->
|
cm = req.body.commits.map (c) ->
|
||||||
[c.committer.username,c.message].join ' -> '
|
[c.committer.username,c.message].join ' -> '
|
||||||
commits = cm.join '\n'
|
commits = cm.join '\n'
|
||||||
robot.send req.params.room, s+commits
|
robot.send dest, s+commits
|
||||||
|
@ -70,6 +70,7 @@ module.exports = (robot) ->
|
|||||||
.get() (err, r, body) ->
|
.get() (err, r, body) ->
|
||||||
res.send 'dovrei essere a ' + body
|
res.send 'dovrei essere a ' + body
|
||||||
robot.respond /con chi stai parlando/i, (res) ->
|
robot.respond /con chi stai parlando/i, (res) ->
|
||||||
|
console.log res.message.user, res.message.room
|
||||||
if res.message.user.name is res.message.room
|
if res.message.user.name is res.message.room
|
||||||
res.send 'sto parlando con te, '+res.message.user.name
|
res.send 'sto parlando con te, '+res.message.user.name
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user