我最近为 irc 安装了一个hubot并且工作正常。我正在尝试添加 this script.
然而,我并不完全理解设置说明。设置说明阅读
curl -H "Authorization: token <your api token>" \
-d '{"name":"web","active":true,"events":["pull_request"],"config":{"url":"<this script url>","content_type":"json"}}' \
https://api.github.com/repos/<your user>/<your repo>/hooks
我不明白
"url":"<this script url>"
指。有人知道吗?如果有帮助,我将部署到 heroku。
最佳答案
为@MikeKusold 的回答添加更多解释curl
命令是创建 github hook ,因此它设置 Hook 到接收器的通知。
"config": {
"url": "http://example.com/webhook",
"content_type": "json"
}
hook是hubot插件,所以url路径定义在that script ,见行
robot.router.post "/hubot/gh-pull-requests", (req, res) ->
该脚本中的下面两行告诉你路径后面是什么,它有参数
room & type
user.room = query.room if query.room
user.type = query.type if query.type
Hubot 本身定义了端口号,它根据请求路由到插件的路径,在 robot.coffee 中检查这部分, 默认端口为
8080
因此网址如下
http://<your hubot sever>:8080/hubot/gh-pull-requests/?room=<room>&type=<type>
其实你可以用
curl
命令首先直接对hubot进行测试。
关于Hubot 的 github-pull-request-notifier.coffee,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18318485/