跳转到主要内容
使用个人访问令牌时,当您保存仓库选择,Kodus 会在每个仓库上创建 webhook。这需要对仓库 webhook 的读写权限:经典令牌需要 admin:repo_hook,细粒度令牌需要 Webhooks: Read and write。如果令牌缺少该权限,Repositories 页面会列出该仓库及原因,您可以按以下方式手动创建 webhook。 使用 GitHub App 时没有按仓库创建的 webhook:事件来自该 App 自己的 webhook。参阅创建 GitHub App。
Webhook URL 必须能到达 Webhooks 服务(端口 3332)。仅当反向代理将 /.../webhook 路径转发到 webhooks 服务时,才能使用 API 域名。
  1. 前往您的 GitHub 仓库
  2. 单击 “Settings”
  3. 在左侧边栏中找到 “Webhooks”
  4. 单击 “Add webhook”
  5. 配置您的 webhook:
    • Payload URL:输入 .env 文件中的 URL:API_GITHUB_CODE_MANAGEMENT_WEBHOOK(以 /github/webhook 结尾)
    • Content type:application/json
    • Secret:留空
    • SSL verification:启用 SSL 验证
    • Which events would you like to trigger this webhook?:Let me select individual events
    • 勾选这些框:
      • Issue comments
      • Pull request review comments
      • Pull requests
  6. 单击 “Add webhook”
您已成功为 GitHub 仓库中的代码审查设置了 webhook。
这些是令牌集成唯一使用的事件。Kodus 会忽略其他事件,例如 push、pull request review 和 review thread,因此勾选它们只会增加流量。