> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kodus.io/llms.txt
> Use this file to discover all available pages before exploring further.

# 创建 Webhook

> 当自动注册未发生时,手动创建 Forgejo webhook,并选择 Kodus 消费的事件。

<Note>
  Forgejo 支持由社区维护。
</Note>

Kodus 通常会自动创建 webhook。如果没有自动创建，请按照以下步骤手动设置：

<Note>
  Webhook URL 必须能够访问 Webhooks 服务（端口 3332）。只有当您的反向代理将 `/.../webhook` 路径路由到 Webhooks 服务时，才可以使用 API 域名。
</Note>

1. 导航到您的 Forgejo 仓库

2. 点击右侧边栏的 **Settings**

3. 选择 **Webhooks**

4. 点击 **Add Webhook** → **Forgejo**

5. 配置您的 webhook：

   * **Target URL**: 输入您希望接收通知的 URL，即您在 `.env` 文件中为 `API_FORGEJO_CODE_MANAGEMENT_WEBHOOK` 设置的 URL
   * **HTTP Method**: POST
   * **POST Content Type**: `application/json`
   * **Trigger On**: 选择以下事件：
     * Push events
     * Pull Request events
     * Issue Comment events
   * **Active**: 勾选

6. 点击 **Add Webhook**

大功告成！您已成功为 Forgejo 仓库设置了代码审查的 webhook。

<Note>
  Kodus 消费 pull request、push、pull request review comment 和 issue comment 事件。
  push 事件在 Forgejo 上尤其重要:它是唯一同时携带分支变更前后 head 的事件,Kodus 借此
  检测 force-push 并把分支映射回其开放的 pull request。issue 事件在到达后即被丢弃。
</Note>
