4 Star 1 Fork 0

Gitee 极速下载/codebrag

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/softwaremill/codebrag
克隆/下载
WEBHOOKS.adoc 4.27 KB
一键复制 编辑 原始数据 按行查看 历史
Lukasz Lenart 提交于 2016-02-24 13:27 . Adds missing suffix

WebHooks

Codebrag supports webhooks which can be used to notify external systems about all internal events.

Configuration

Just define the hooks section in your application.conf file based on the below example. These are the supported hooks:

  • like-hook - occurs when a user likes a given change

  • unlike-hook - occurs if a user dislikes the previously liked change

  • comment-added-hook - occurs when a user post a comment

  • commit-reviewed-hook - occurs when a user hit Reviewed button

  • all-commits-reviewed-hook - occurs when a user hit a button and marked all commits to be reviewed as reviewed at once in current repo for current branch

  • new-commits-loaded-hook - occurs after loading by Codebrag new commits from repo

  • new-user-registered-hook - occurs on registering a new user in the system

You can define multiple listeners for every hook, just separate urls by comma

Example configuration

hooks {
    like-hook = ["http://localhost:8000/", "http://some.other.host:9898/"]
    unlike-hook = ["http://localhost:8000/"]
}

Format

Right now Codebrag sends hooks as JSON encoded as UTF-8, below is the list of formats for each hook:

like-hook

{
  "commitInfo": {
    "repoName": string,
    "sha": string,
    "message": string,
    "authorName": string,
    "authorEmail": string,
    "committerName": string,
    "committerEmail": string,
    "authorDate": date,
    "commitDate": date,
    "parents": [string, string]
  },
  "likedBy": {
    "name": string,
    "emailLowerCase": string,
    "aliases": [{
      "alias": string
    }]
  },
  "like": {
    "postingTime": date,
    "fileName": string,
    "lineNumber": int
  },
  "hookName": "like-hook",
  "hookDate": date
}

unlike-hook

{
  "commitInfo": {
    "repoName": string,
    "sha": string,
    "message": string,
    "authorName": string,
    "authorEmail": string,
    "committerName": string,
    "committerEmail": string,
    "authorDate": date,
    "commitDate": date,
    "parents": [string, string]
  },
  "unlikedBy": {
    "name": string,
    "emailLowerCase": string,
    "aliases": [{
      "alias": string
    }]
  },
  "like": {
    "postingTime": date,
    "fileName": string,
    "lineNumber": int
  },
  "hookName": "unlike-hook",
  "hookDate": date
}

comment-added-hook

{
  "commitInfo": {
    "repoName": string,
    "sha": string,
    "message": string,
    "authorName": string,
    "authorEmail": string,
    "committerName": string,
    "committerEmail": string,
    "authorDate": date,
    "commitDate": date,
    "parents": [string, string]
  },
  "commentedBy": {
    "name": string,
    "emailLowerCase": string,
    "aliases": [{
      "alias": string
    }]
  },
  "comment": {
    "message": string,
    "postingTime": date,
    "fileName": string,
    "lineNumber": int
  },
  "hookName": "comment-added-hook",
  "hookDate": date
}

commit-reviewed-hook

{
  "commitInfo": {
    "repoName": string,
    "sha": string,
    "message": string,
    "authorName": string,
    "authorEmail": string,
    "committerName": string,
    "committerEmail": string,
    "authorDate": date,
    "commitDate": date,
    "parents": [string, string]
  },
  "reviewedBy": {
    "name": string,
    "emailLowerCase": string,
    "aliases": [{
      "alias": string
    }]
  },
  "hookName": "commit-reviewed-hook",
  "hookDate": date
}

all-commits-reviewed-hook

{
  "repoName": string,
  "branchName": string,
  "reviewedBy": {
    "name": string,
    "emailLowerCase": string,
    "aliases": [{
      "alias": string
    }]
  },
  "hookName": "all-commitc-reviewed-hook",
  "hookDate": date
}

comment-added-hook

{
  "repoName": string,
  "currentSHA": string,
  "newCommits": [
    {
      "sha": string,
      "message": string,
      "authorName": string,
      "authorEmail": string,
      "date": date
    }
  ],
  "hookName": "new-commits-loaded-hook",
  "hookDate": date
}

new-user-registered-hook

{
  "newUser": {
    "name": string,
    "emailLowerCase": string,
    "aliases": [{
      "alias": string
    }]
  },
  "login": string,
  "fullName": string,
  "hookName": "new-user-registered-hook",
  "hookDate": date
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/codebrag.git
git@gitee.com:mirrors/codebrag.git
mirrors
codebrag
codebrag
master

搜索帮助