Created
September 6, 2012 21:56
-
-
Save ajacksified/3660666 to your computer and use it in GitHub Desktop.
travis hubot hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description: | |
# "Travis CI alert hook" | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: | |
# POST /hubot/travis [data] | |
# | |
# Authors: | |
# ajacksified | |
# todo - validate travis hash | |
querystring = require('querystring') | |
util = require 'util' | |
module.exports = (robot) -> | |
robot.router.post "/hubot/travis", (req, res) -> | |
query = querystring.parse(req._parsedUrl.query) | |
user = | |
room: query.room | |
robot.logger.info util.inspect(JSON.parse(req.body.payload)) | |
data = JSON.parse(req.body.payload) | |
build_environments = | |
1: "Lua", | |
2: "Luajit" | |
message = " | |
-----------------\n | |
#{data.status_message.toUpperCase()} on #{build_environments[data.matrix[0].number.split(".")[1]]} <#{data.repository.name}> [#{data.commit}]\n | |
Compare: #{data.compare_url}\n | |
Committed by #{data.committer_name} at #{data.committed_at}\n | |
-----------------" | |
res.end "Said #{message}" | |
robot.send(user, message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment