Skip to content

Instantly share code, notes, and snippets.

@hotakasaito
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hotakasaito/7c2b79a659a301c6dac6 to your computer and use it in GitHub Desktop.
Save hotakasaito/7c2b79a659a301c6dac6 to your computer and use it in GitHub Desktop.
trelloのカードをgithubのissueにslackから追加する ref: http://qiita.com/hotakasaito/items/a97fad861c460c3faaa2
npm install node-trello --save
npm install octonode --save
# 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