跳到正文
GitHub Changelog· Allison·· 2 天前AI 评分53

GitHub 支持通过 REST API 管理仓库的 AI Scan 代码扫描

Manage AI Scan for repositories using the REST API

AI 导读

GitHub 推出 REST API 公开预览,支持在组织和仓库层级启用或关闭代码扫描的 AI Scan 功能。用户可通过相关端点配置 repository_scan 属性,使用脚本或基础设施即代码完成批量管理,并支持组织级继承与单仓库退出机制。开启该配置不会自动触发扫描,拥有写入权限的用户仍需按需运行并消耗 GitHub Code Security AI 点数。

正文 · 原文

You can now turn GitHub code scanning’s AI Scan for repositories on or off with the REST API at the organization and repository levels. This public preview adds a repository_scan setting to the existing AI Scan enablement endpoints. You can roll out AI Scan for repositories with scripts and infrastructure as code instead of changing settings one organization or repository at a time.

Manage AI Scan for repositories at scale

Set the repository_scan property to enabled or disabled on the AI Scan enablement endpoints:

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

The setting works the same way as the existing pr_scan setting for AI Scan for pull requests:

  • When an organization disables AI Scan for repositories, its repositories can’t enable it
  • When an organization enables it, its repositories inherit the setting and can opt out individually
  • When an enterprise policy doesn’t allow AI Scan, requests to enable it return a 422 error

You can update pr_scan and repository_scan in the same request. If either change is blocked, the request returns a 422 error and neither setting changes.

Turning on AI Scan for repositories doesn’t start a scan. Users with write access still run scans on demand, and each scan consumes GitHub Code Security AI credits.

Who can use it

Organization owners and security managers can manage the organization setting. Repository administrators can opt individual repositories out. AI Scan for repositories is available for public repositories owned by organizations and for private or internal repositories with GitHub Code Security or GitHub Advanced Security. Enterprise owners must first allow AI Scan in the enterprise policy. GitHub Enterprise Server isn’t supported.

To get started, see REST API endpoints for code scanning and AI Scan for a repository’s backlog.

Join the discussion in the GitHub Community.

The post Manage AI Scan for repositories using the REST API appeared first on The GitHub Blog.

来源:GitHub Changelog · github.blog

EVAOO 主站实战落地 · AI Agent 与研发提效

看完情报?回到 EVAOO 主站直接上手工具与完整 SOP

返回 EVAOO 主站