Hubot 的 github-pull-request-notifier.coffee

标签 hubot

我最近为 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/

相关文章:

node.js - robots.router 和 robots.http 有什么区别?

javascript - 我可以用 Javascript 为 hubot 编写脚本吗?

hubot - 我可以在 Slack 上安装多个 Hubot 吗

javascript - 如何使用 Hubot 运行异步 Ruby 脚本?

node.js:WAITING所有线程完成

javascript - 回复.发送理解吗? (hubot 脚本)

javascript - 为 Hubot 添加 Post 支持

regex - 在 Coffeescript 中匹配 Hubot 的名字