Created
April 10, 2015 11:48
-
-
Save yo-iida/89e6a5faef9c934dd7ca to your computer and use it in GitHub Desktop.
gitbuckest-to-slack
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: | |
| # gitbucket to Slack | |
| # | |
| # Commands: | |
| # None | |
| module.exports = (robot) -> | |
| robot.router.post "/gitbucket-to-slack/:room", (req, res) -> | |
| { room } = req.params | |
| { body } = req | |
| try | |
| if body.payload | |
| json = JSON.parse body.payload | |
| message = "==== commit info ====\n" | |
| message += "timestamp: #{json.commits[0].timestamp}\n" | |
| message += "id: #{json.commits[0].id}\n" | |
| message += "author: #{json.commits[0].author.name}<#{json.commits[0].author.email}>\n" | |
| message += "message: #{json.commits[0].message}\n" | |
| message += "url: #{json.commits[0].url}\n" | |
| if message? | |
| robot.messageRoom room, message | |
| res.end "OK" | |
| else | |
| robot.messageRoom room, "gitbucket integration error." | |
| res.end "Error" | |
| catch error | |
| robot.send | |
| res.end "Error" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment