Newshot
Account

使用 REST API 管理仓库的 AI Scan

AI summary

现在,你可以通过 REST API 在组织级和仓库级开启或关闭 GitHub 代码扫描的仓库 AI Scan。该公开预览版在现有的 AI Scan 启用端点中新增了 repository_scan 设置。你可以借助脚本和基础设施即代码来推广仓库 AI Scan,而无需逐个组织或逐个仓库地更改设置。

Translation(model translation, not the source's own text)
说明
说明

现在,你可以通过 REST API 在组织级别和仓库级别开启或关闭 GitHub 代码扫描的 AI Scan for repositories。此公开预览版在现有的 AI Scan 启用端点上新增了 repository_scan 设置。你可以使用脚本和基础设施即代码来为仓库推行 AI Scan,而不必逐个组织或逐个仓库地更改设置。

大规模管理 AI Scan for repositories

在 AI Scan 启用端点上将 repository_scan 属性设置为 enabled 或 disabled:

  • GET 和 PATCH /orgs/{org}/code-scanning/ai-scan
  • GET 和 PATCH /repos/{owner}/{repo}/code-scanning/ai-scan

该设置的工作方式与现有的、用于 AI Scan for pull requests 的 pr_scan 设置相同:

  • 当组织禁用 AI Scan for repositories 时,其下的仓库无法启用该功能
  • 当组织启用该功能时,其下的仓库会继承该设置,并可单独选择退出
  • 当企业策略不允许 AI Scan 时,启用它的请求会返回 422 错误

你可以在同一个请求中更新 pr_scan 和 repository_scan。如果其中任一更改被阻止,请求会返回 422 错误,且两项设置都不会变更。

开启 AI Scan for repositories 并不会启动扫描。具有写入权限的用户仍需按需运行扫描,且每次扫描都会消耗 GitHub Code Security AI credits。

谁可以使用

组织所有者和安全管理者可以管理组织设置。仓库管理员可以让单个仓库选择退出。AI Scan for repositories 适用于组织拥有的公开仓库,以及具备 GitHub Code Security 或 GitHub Advanced Security 的私有或内部仓库。企业所有者必须首先在企业策略中允许 AI Scan。不支持 GitHub Enterprise Server。

要开始使用,请参阅 REST API endpoints for code scanning 以及 AI Scan for a repository’s backlog。

欢迎在 GitHub Community 中加入讨论。

The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.

Published by GitHub Changelog
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗