Hubot的github-pull-request-notifier.coffee

Bla*_*ten 6 hubot

我最近得到了irc的hubot设置并且工作正常.我正在尝试添加此脚本.

但是,我并不完全理解设置说明.阅读设置说明

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
Run Code Online (Sandbox Code Playgroud)

我不明白所指的"url":"<this script url>"是什么.谁知道?

如果有帮助我正在部署到heroku.

Lar*_*Cai 5

为@MikeKusold的答案添加更多说明

curl命令是创建github钩子,因此将其设置为钩子到接收者的通知。

"config": {
  "url": "http://example.com/webhook",
  "content_type": "json"
}
Run Code Online (Sandbox Code Playgroud)

该钩子是hubot插件,因此url路径是在该脚本中定义的,请参见第4行

robot.router.post "/hubot/gh-pull-requests", (req, res) ->
Run Code Online (Sandbox Code Playgroud)

该脚本的下面两行告诉您路径之后是什么,它具有参数 room & type

user.room = query.room if query.room
user.type = query.type if query.type
Run Code Online (Sandbox Code Playgroud)

Hubot本身定义了端口号,它根据请求将路径路由到插件,在robot.coffee中检查此部分,默认端口为8080

因此,URL如下所示

http://<your hubot sever>:8080/hubot/gh-pull-requests/?room=<room>&type=<type>
Run Code Online (Sandbox Code Playgroud)

实际上,您可以先使用curl命令直接对hubot进行测试。


Mik*_*old 1

Add <HUBOT_URL>:<PORT>/hubot/gh-pull-requests?room=<room>[&type=<type>] url hook via API

这就是网址