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

# 列出 Devin Review 触发器

> 列出某个 API 密钥在组织中可见的 Devin Review auto-review 规则和排除规则，并附带各自的版本 ID。

分页列出调用方可见的 [Devin Review auto-review](https://docs.devinenterprise.com/zh/work-with-devin/devin-review.md#auto-review) 规则和排除规则。每个触发器都带有一个 `version_id`，[更改或删除](https://docs.devinenterprise.com/zh/api-reference/v3/review-triggers/update-review-triggers.md)该触发器时需传回此值。

## 权限

需要在该组织中拥有 `ManageReview` 权限的[服务用户](https://docs.devinenterprise.com/zh/api-reference/v3/service-users/members-service-users.md)或[个人访问令牌](https://docs.devinenterprise.com/zh/api-reference/personal-access-tokens.md)。个人访问令牌以其所属用户的身份执行操作。拥有账户级 `ManageReview` 权限时，调用方可以管理所有作用域；组织级 `ManageReview` 权限仅适用于该组织可访问的代码仓库。

## 行为

* 结果为分页返回：`first` 设置每页大小 (默认 100，最大 200) ，`after` 传入上一页的 `end_cursor`。规则排在前面，排除规则排在后面。
* 每个条目的 `kind` 为 `rule` (自动发起审查) 或 `exclusion` (阻止对匹配的拉取请求进行审查) 。传入 `kind` 可仅列出其中一类。
* 标记为 `readonly` 的触发器对调用方可见，但调用方无法修改。
* `capabilities` 会针对账户作用域以及当前页中触发器所用的每个作用域，指明调用方是否可以向其附加触发器。
* 如果组织未启用 Review 触发器，则返回 `404`。


## OpenAPI

````yaml zh/v3-openapi.yaml GET /v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers
openapi: 3.1.0
info:
  description: 采用 Service User 身份验证和 RBAC 的 Devin v3 API
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers:
    get:
      tags:
        - review-settings
      summary: 列出默认审查者触发器
      description: |-
        调用方可见的一页默认审查者触发器，先列出规则，
        再列出排除规则；调用方无权更改的条目均标记为 readonly，
        同时提供本页使用的各个作用域是否可编辑的信息。
      operationId: >-
        handle_list_review_triggers_v3beta1_organizations__org_id__review_settings_default_reviewer_triggers_get
      parameters:
        - description: 组织 ID（前缀：org-）
          in: path
          name: org_id
          required: true
          schema:
            example: org-abc123def456
            title: Org Id
            type: string
        - in: query
          name: after
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: After
        - in: query
          name: first
          required: false
          schema:
            default: 100
            maximum: 200
            minimum: 1
            title: First
            type: integer
        - description: 仅包含规则，或仅包含排除规则。
          in: query
          name: kind
          required: false
          schema:
            anyOf:
              - enum:
                  - rule
                  - exclusion
                type: string
              - type: 'null'
            description: 仅包含规则，或仅包含排除规则。
            title: Kind
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReviewTriggersResponse'
          description: 成功响应
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 未授权
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 禁止访问
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 未找到
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 冲突
        '410':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 已移除
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 无法处理的内容
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 请求过多
components:
  schemas:
    ReviewTriggersResponse:
      description: |-
        一页触发器，先列出规则，再列出排除规则（每个条目的 ``kind``
        指明其类型）。
      properties:
        actor_kind:
          description: 调用方的授权方式：'account'（account-wide）、'organization'（一个组织的仓库）或 'user'。
          enum:
            - account
            - organization
            - user
          title: Actor Kind
          type: string
        actor_org_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Actor Org Id
        broken_count:
          description: 此服务器无法解析的已存储条目；webapp 会显示这些条目。
          title: Broken Count
          type: integer
        can_edit:
          title: Can Edit
          type: boolean
        capabilities:
          description: 本页触发器使用的各个作用域及账户作用域是否可编辑。
          items:
            $ref: '#/components/schemas/ReviewScopeCapabilityResponse'
          title: Capabilities
          type: array
        end_cursor:
          anyOf:
            - type: string
            - type: 'null'
          description: 用于获取下一页的游标；若当前页为最后一页，则为 None。
          title: End Cursor
        has_next_page:
          default: false
          description: 本页之后是否还有更多条目。
          title: Has Next Page
          type: boolean
        items:
          items:
            $ref: '#/components/schemas/ReviewTriggerResponse'
          title: Items
          type: array
        total:
          anyOf:
            - type: integer
            - type: 'null'
          description: 可选的条目总数（可出于性能考虑省略）。
          title: Total
      required:
        - items
        - actor_kind
        - actor_org_id
        - can_edit
        - broken_count
        - capabilities
      title: ReviewTriggersResponse
      type: object
    ProblemDetail:
      description: >-
        v3 API 的 RFC 9457 application/problem+json 错误响应体。


        detail 沿用自旧版 {"detail": ...} 响应体，以保持向后兼容；其他成员字段为新增字段。errors
        包含字段级验证失败信息（仅 422）。
      properties:
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: 针对此次具体情况的、便于人理解的说明。
          title: Detail
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          description: 因操作被阻止而拒绝请求时返回的机器可读代码（例如 "user_frozen"、"migrated_session"）。
          title: Error Code
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: 字段级验证错误（仅适用于 422 响应）。
          title: Errors
        instance:
          anyOf:
            - type: string
            - type: 'null'
          description: 此次出现对应的 URI 引用（请求路径）。
          title: Instance
        status:
          description: HTTP 状态码。
          title: Status
          type: integer
        title:
          description: 对问题类型的简短、便于理解的概述。
          title: Title
          type: string
        type:
          default: about:blank
          description: 用于标识问题类型的 URI 引用。
          title: Type
          type: string
      required:
        - title
        - status
      title: ProblemDetail
      type: object
    ReviewScopeCapabilityResponse:
      properties:
        next_action:
          enum:
            - none
            - relink
            - use_github_app
            - grant_app_access
            - request_scope_access
          title: Next Action
          type: string
        scope:
          $ref: '#/components/schemas/ReviewScopeResponse'
        status:
          description: 调用方可以向该作用域附加触发器时为 'available'；否则为无法附加的原因。
          enum:
            - available
            - readonly
            - inaccessible
            - github_pat_unsupported
            - relink_required
            - unsupported
            - broader_grant_required
          title: Status
          type: string
      required:
        - scope
        - status
        - next_action
      title: ReviewScopeCapabilityResponse
      type: object
    ReviewTriggerResponse:
      properties:
        cadence:
          anyOf:
            - enum:
                - once
                - every_push
              type: string
            - type: 'null'
          description: 规则：仅审查一次，或每次推送时重新审查。排除规则下为 Null。
          title: Cadence
        conditions:
          anyOf:
            - $ref: '#/components/schemas/ReviewTriggerConditions-Output'
            - type: 'null'
          description: 按审查设置编辑器保存的形式，通过 AND（'all'）或 OR（'any'）连接的子句；null 匹配所有 pull request。
        created_at:
          title: Created At
          type: integer
        effort:
          anyOf:
            - enum:
                - default
                - normal
                - ultra
              type: string
            - type: 'null'
          description: 仅适用于规则。
          title: Effort
        entity_id:
          title: Entity Id
          type: string
        kind:
          enum:
            - rule
            - exclusion
          title: Kind
          type: string
        modified_by_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Modified By User Id
        readonly:
          title: Readonly
          type: boolean
        removable:
          title: Removable
          type: boolean
        scope:
          $ref: '#/components/schemas/ReviewScopeResponse'
        start:
          anyOf:
            - enum:
                - pr_open
                - pr_ready
                - check_passed
                - pre_pr
                - with_review
              type: string
            - type: 'null'
          description: >-
            规则：指定首次审查的运行时机，即在创建 PR 时或 PR
            准备好接受审查时。在审查设置中保存的规则还可以在检查通过时（'check_passed'）、PR
            创建前（'pre_pr'）或仅随其他审查一起（'with_review'）触发。排除规则的此值为 null。
          title: Start
        version_id:
          description: 每次保存时都会更改；将其作为 expected_version_id 传回。
          title: Version Id
          type: string
      required:
        - entity_id
        - version_id
        - kind
        - scope
        - conditions
        - start
        - cadence
        - effort
        - readonly
        - removable
        - modified_by_user_id
        - created_at
      title: ReviewTriggerResponse
      type: object
    ReviewScopeResponse:
      properties:
        kind:
          enum:
            - account
            - user
            - git_organization
            - git_repository
          title: Kind
          type: string
        target:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            git_repository：代码仓库名称，在 github.com 上为 'owner/repo'，在其他主机上为
            'host/path'（'gitlab.example.com/group/sub/repo'），每个路径段均采用百分号编码。git_organization：格式相同的命名空间，以
            '/' 结尾。账户和用户作用域下为 Null。
          title: Target
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
      required:
        - kind
        - target
      title: ReviewScopeResponse
      type: object
    ReviewTriggerConditions-Output:
      additionalProperties: false
      properties:
        clauses:
          items:
            discriminator:
              mapping:
                author: '#/components/schemas/ReviewTriggerUserClause'
                author_type: '#/components/schemas/ReviewTriggerAuthorTypeClause'
                changed_file: '#/components/schemas/ReviewTriggerPatternClause'
                label: '#/components/schemas/ReviewTriggerLabelClause'
                line_diff: '#/components/schemas/ReviewTriggerLineDiffClause'
                originated_by: '#/components/schemas/ReviewTriggerOriginatedByClause'
                repo_visibility: '#/components/schemas/ReviewTriggerRepoVisibilityClause'
                repository: '#/components/schemas/ReviewTriggerRepositoryClause'
                reviewer: '#/components/schemas/ReviewTriggerUserClause'
                source_branch: '#/components/schemas/ReviewTriggerPatternClause'
                target_branch: '#/components/schemas/ReviewTriggerPatternClause'
                title: '#/components/schemas/ReviewTriggerPatternClause'
              propertyName: kind
            oneOf:
              - $ref: '#/components/schemas/ReviewTriggerUserClause'
              - $ref: '#/components/schemas/ReviewTriggerLabelClause'
              - $ref: '#/components/schemas/ReviewTriggerPatternClause'
              - $ref: '#/components/schemas/ReviewTriggerRepositoryClause'
              - $ref: '#/components/schemas/ReviewTriggerAuthorTypeClause'
              - $ref: '#/components/schemas/ReviewTriggerOriginatedByClause'
              - $ref: '#/components/schemas/ReviewTriggerRepoVisibilityClause'
              - $ref: '#/components/schemas/ReviewTriggerLineDiffClause'
          maxItems: 50
          minItems: 1
          title: Clauses
          type: array
        match:
          description: '`all`：必须匹配所有子句；`any`：必须至少匹配一个子句。'
          enum:
            - all
            - any
          title: Match
          type: string
      required:
        - match
        - clauses
      title: ReviewTriggerConditions
      type: object
    ReviewTriggerUserClause:
      additionalProperties: false
      properties:
        kind:
          description: pull request 的作者或受邀的审查者。
          enum:
            - author
            - reviewer
          title: Kind
          type: string
        negate:
          default: false
          description: 匹配不符合该子句的拉取请求。
          title: Negate
          type: boolean
        users:
          description: 目标用户为这些用户中的任意一位时即匹配。
          items:
            $ref: '#/components/schemas/ReviewTriggerUser'
          minItems: 1
          title: Users
          type: array
      required:
        - kind
        - users
      title: ReviewTriggerUserClause
      type: object
    ReviewTriggerAuthorTypeClause:
      additionalProperties: false
      properties:
        kind:
          const: author_type
          title: Kind
          type: string
        negate:
          default: false
          description: 匹配不符合该子句的拉取请求。
          title: Negate
          type: boolean
        value:
          items:
            enum:
              - user
              - bot
              - devin
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerAuthorTypeClause
      type: object
    ReviewTriggerPatternClause:
      additionalProperties: false
      properties:
        kind:
          enum:
            - title
            - source_branch
            - target_branch
            - changed_file
          title: Kind
          type: string
        match:
          default: glob
          enum:
            - glob
            - exact
          title: Match
          type: string
        negate:
          default: false
          description: 匹配不符合该子句的拉取请求。
          title: Negate
          type: boolean
        value:
          items:
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerPatternClause
      type: object
    ReviewTriggerLabelClause:
      additionalProperties: false
      properties:
        kind:
          const: label
          title: Kind
          type: string
        negate:
          default: false
          description: 匹配不符合该子句的拉取请求。
          title: Negate
          type: boolean
        value:
          items:
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerLabelClause
      type: object
    ReviewTriggerLineDiffClause:
      additionalProperties: false
      properties:
        kind:
          const: line_diff
          description: 新增行数与删除行数之和。
          title: Kind
          type: string
        negate:
          default: false
          description: 匹配不符合该子句的拉取请求。
          title: Negate
          type: boolean
        operator:
          enum:
            - lt
            - lte
            - gt
            - gte
          title: Operator
          type: string
        value:
          minimum: 0
          title: Value
          type: integer
      required:
        - kind
        - operator
        - value
      title: ReviewTriggerLineDiffClause
      type: object
    ReviewTriggerOriginatedByClause:
      additionalProperties: false
      properties:
        kind:
          const: originated_by
          description: 该 pull request 由 Devin 会话创建或接管。
          title: Kind
          type: string
        negate:
          default: false
          description: 匹配不符合该子句的拉取请求。
          title: Negate
          type: boolean
        value:
          items:
            const: devin
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerOriginatedByClause
      type: object
    ReviewTriggerRepoVisibilityClause:
      additionalProperties: false
      properties:
        kind:
          const: repo_visibility
          description: 代码仓库是公开还是私有。仅适用于 Git 组织或前缀作用域。
          title: Kind
          type: string
        negate:
          default: false
          description: 匹配不符合该子句的拉取请求。
          title: Negate
          type: boolean
        value:
          items:
            enum:
              - public
              - private
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerRepoVisibilityClause
      type: object
    ReviewTriggerRepositoryClause:
      additionalProperties: false
      properties:
        kind:
          const: repository
          title: Kind
          type: string
        match:
          default: glob
          enum:
            - glob
            - exact
          title: Match
          type: string
        negate:
          default: false
          description: 匹配不符合该子句的拉取请求。
          title: Negate
          type: boolean
        value:
          description: '''owner/repo'' 格式的名称或 glob 模式。'
          items:
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerRepositoryClause
      type: object
    ReviewTriggerUser:
      additionalProperties: false
      properties:
        kind:
          description: '`devin`：通过用户 ID 指定的账户成员，使用其已关联的 git 登录名进行匹配；`scm`：git 登录名。'
          enum:
            - devin
            - scm
          title: Kind
          type: string
        value:
          minLength: 1
          title: Value
          type: string
      required:
        - kind
        - value
      title: ReviewTriggerUser
      type: object
  securitySchemes:
    bearerAuth:
      description: 服务用户凭据（前缀：cog_）
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.