trelloのカードをgithubのissueにslackから追加する
5891 ワード
trelloでタスク管理を行っているとそのままgithubのissueにしたい場合があったので、slackからtrelloのカードをgithub issueに追加できるようにしてみた。
npmで必要パッケージのインストール
npm install node-trello --save
npm install octonode --save
trello token 取得
github token 取得
hubot script
-
trello <shortLink> to <repository>
の形式でslackからhubotに指示を出す
shortLinkは https://trello.com/c/xxx のxxx
部分
repository は username から入れる。https://github.com/github/hubot の場合はgithub/hubot
がそれ
# 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```"
npm package
未だ手直し予定ありですが、npmに公開した。
https://www.npmjs.com/package/hubot-trello-to-github
Author And Source
この問題について(trelloのカードをgithubのissueにslackから追加する), 我々は、より多くの情報をここで見つけました https://qiita.com/hotakasaito/items/a97fad861c460c3faaa2著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .