Last active
August 29, 2015 14:00
-
-
Save saboyutaka/11163046 to your computer and use it in GitHub Desktop.
GitHub webhookが出力するログをidobataで特定のroomで再度mentionする。
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
module.exports = (robot) -> | |
robot.hear /.*/, (msg) -> | |
if process.env.HUBOT_IDOBATA_GITHUB_MENTION_ROOM and | |
process.env.HUBOT_GITHUB_REPO and | |
msg.message.user.name is 'GitHub' and | |
!/@/.test(msg.message.text) | |
msg.message.data.room_id = process.env.HUBOT_IDOBATA_GITHUB_MENTION_ROOM | |
repo = process.env.HUBOT_GITHUB_REPO | |
message_text = msg.message.text | |
reg = new RegExp(repo + '#(\\d+)') | |
result = message_text.match reg | |
link = "https://github.com/#{repo}/issues/#{result[1]}" | |
msg.send message_text.replace reg, link |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment