Created
March 15, 2014 20:42
-
-
Save mattbasta/9573663 to your computer and use it in GitHub Desktop.
This file contains 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
var irc = require('irc'); | |
var client = new irc.Client('irc.mozilla.org', 'carly_rae_jenkins', { | |
channels: ['#amo', '#breakpad'], | |
}); | |
function contains(message, list) { | |
for(var i=0;i<list.length;i++) { | |
var l = list[i]; | |
if(message.indexOf(l) > -1) | |
return true; | |
} | |
} | |
var jenkins = "jenkins"; | |
var waiting = false; | |
client.addListener('message', function(from, to, message) { | |
if(from != jenkins) | |
return; | |
if(contains(message, [": FAILURE in", ": UNSTABLE in"])) { | |
waiting = true; | |
setTimeout(function() { | |
waiting = false; | |
}, 5000); | |
} else if(waiting) { | |
var pos = 0; | |
if((pos = message.indexOf(": ")) == -1) | |
return; | |
var victim = message.substring(0, pos); | |
client.say(to, "The build is broken"); | |
client.say(to, "And this is crazy"); | |
client.say(to, "but " + victim + " broke it"); | |
client.say(to, "so fix it maybe"); | |
waiting = false; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment