Skip to content

Instantly share code, notes, and snippets.

@ryonext
Created January 19, 2015 14:54
Show Gist options
  • Save ryonext/2906f7bd9c865c2d8f1b to your computer and use it in GitHub Desktop.
Save ryonext/2906f7bd9c865c2d8f1b to your computer and use it in GitHub Desktop.
Hubotでpull reqつくるやつ
# Description:
# Create pull request from develop to master.
#
# Dependencies:
# "githubot": "0.4.x"
#
# Configuration:
# HUBOT_GITHUB_TOKEN
# HUBOT_GITHUB_USER
# HUBOT_GITHUB_ORG
#
# Commands:
# hubot deploy <repo>
#
# Author:
# ryonext
module.exports = (robot) ->
github = require("githubot")(robot)
robot.respond /deploy ?(.+)/i, (msg) ->
repo = msg.match[1]
url_api_base = "https://api.github.com"
data = {
"title": "deploy",
"head": "develop",
"base": "master"
}
ghOrg = process.env.HUBOT_GITHUB_ORG
url = "#{url_api_base}/repos/#{ghOrg}/#{repo}/pulls"
github.post url, data, (response) ->
msg.send "本番にデプロイするプルリクエストを作成したよ!確認してマージしてね!"
msg.send response.html_url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment