Skip to content

Instantly share code, notes, and snippets.

@jdowning
Last active December 12, 2015 03:48
Show Gist options
  • Select an option

  • Save jdowning/4709499 to your computer and use it in GitHub Desktop.

Select an option

Save jdowning/4709499 to your computer and use it in GitHub Desktop.
Hubot script for GitHub Status
# Description:
# Get GitHub status
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# github status - Responds with site health
# github status message - Responds with last status message
#
# Author:
# justindowning
module.exports = (robot) ->
robot.hear /^github status$/i, (msg) ->
msg.http("https://status.github.com/api/status.json")
.get() (err, res, body) ->
status = JSON.parse(body)
switch status.status
when "good" then msg.send "GitHub Status is Good :grinning:"
when "minor" then msg.send "GitHub Status is Degraded :worried:"
when "major" then msg.send "GitHub Status is Down :weary:"
else console.log("Uh oh, I don't know this status: " + status.status)
robot.hear /^github status message$/i, (msg) ->
msg.http("https://status.github.com/api/last-message.json")
.get() (err, res, body) ->
status = JSON.parse(body)
msg.send ":octocat: says: " + status.body
robot.respond /(github help)/i, (msg) ->
response = "GitHub Status\n" +
"\n" +
"Usage:\n" +
" github status\n" +
" github status message\n" +
"\n" +
"Get the GitHub status or the last status message."
msg.send response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment