跳转到主要内容
Forgejo 支持由社区维护。
当您保存仓库选择时,Kodus 通常会自动创建 webhook。这需要仓库的管理员权限,以及令牌上的 write:repository 范围。如果自动创建没有发生,Repositories 页面会列出该仓库及原因,您可以手动设置 webhook:
Webhook URL 必须能到达 Webhooks 服务(端口 3332)。仅当反向代理将 /.../webhook 路径转发到 webhooks 服务时,才能使用 API 域名。
  1. 导航到您的 Forgejo 仓库
  2. 打开仓库的 Settings 选项卡
  3. 选择 Webhooks
  4. 点击 Add webhook → Forgejo
  5. 配置您的 webhook:
    • Target URL:输入您在 .env 文件中为 API_FORGEJO_CODE_MANAGEMENT_WEBHOOK 设置的 URL(以 /forgejo/webhook 结尾)
    • HTTP method:POST
    • POST content type:application/json
    • Trigger on:Custom events,然后选择:
      • Repository events:Push
      • Pull request events:Modification、Synchronized 和 Comments
    • Active:勾选
  6. 点击 Add webhook
大功告成!您已成功为 Forgejo 仓库设置了代码审查的 webhook。
Forgejo 将 pull request 评论作为 issue_comment 投递,而 Kodus 处理 pull_request、push 和 issue_comment 的投递。在 pull request 事件中,它处理 opened、synchronized、reopened 和 closed;Synchronized 负责投递 pull request 上的新提交。push 事件在 Forgejo 上尤其重要:它是唯一同时携带分支变更前后 head 的事件,Kodus 借此检测 force-push 并把分支映射回其开放的 pull request。issue 事件在到达后即被丢弃。