Last active
December 12, 2015 03:48
-
-
Save jdowning/4709499 to your computer and use it in GitHub Desktop.
Hubot script for GitHub Status
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: | |
| # 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