Last active
August 29, 2015 14:18
-
-
Save hotakasaito/7c2b79a659a301c6dac6 to your computer and use it in GitHub Desktop.
trelloのカードをgithubのissueにslackから追加する ref: http://qiita.com/hotakasaito/items/a97fad861c460c3faaa2
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
npm install node-trello --save | |
npm install octonode --save |
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
# Description: | |
# Sample | |
trello = require("node-trello") | |
t = new trello("***", "***") | |
github = require('octonode') | |
g = github.client("***") | |
module.exports = (robot) -> | |
robot.hear /\btrello\s+(\S+)\s+to\s+(\S+)/i, (msg) -> | |
shortLink = msg.match[1] | |
repository = msg.match[2] | |
ghrepo = g.repo(repository) | |
# shortlinkからtrelloカード情報を取得する | |
t.get "/1/cards/#{shortLink}", (err, data) -> | |
# カードのurlとdescriptionを追加する場合 | |
ghrepo.issue {title: data.name, body: "#{data.shortUrl}\n\n#{data.desc}"}, (err, body, headers) -> | |
msg.reply "`#{body.title}`\n>>>\n#{body.html_url}\n```\n#{body.body}\n```" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment