Skip to main content

使用 Copilot 云代理创建自动化

创建和管理 automations 以按计划运行 Copilot cloud agent 或响应事件。

谁可以使用此功能?

Automations可用于GitHub Copilot Pro、GitHub Copilot Pro+、GitHub Copilot Max、GitHub Copilot Business和GitHub Copilot Enterprise计划。 Automations 仅在专用存储库和内部存储库中可用。 在已被存储库管理员禁用、由 托管用户帐户 拥有的存储库中,或在未启用 Copilot cloud agent 的存储库中,它们不可用。
Sign up for Copilot

Introduction

使用 automations,您可以将 Copilot cloud agent 设置为自动运行,可以按计划运行,也可以在响应存储库中的事件时运行。 Automations 可以在其配置所在的仓库中执行操作,例如发起拉取请求或为议题添加标签。

可以从 automations 上存储库的“智能体”**** 选项卡中创建和管理 GitHub。 还可以在automations的Automations 选项卡中创建和管理GitHub Copilot app。

有关触发器、工具、可见性和安全性的概述 automations,请参阅 关于 Copilot 自动化

先决条件

若要 automations 在存储库中可用,以下所有内容都必须为 true:

  • 存储库必须是 专用存储库或内部存储库。 Automations 在公共存储库中不可用。
  • 必须为该存储库启用 Copilot cloud agent。 如果您拥有 Copilot Business 或 Copilot Enterprise,则管理员必须启用 Copilot cloud agent 策略。 请参阅“管理对 GitHub Copilot 云代理的访问权限”。
  • 组织必须在存储库中同时允许 Copilot cloud agent 和 automations(二者默认均处于启用状态)。 请参阅“将GitHub Copilot云代理添加到组织”。

Automations可用于GitHub Copilot Pro、GitHub Copilot Pro+、GitHub Copilot Max、GitHub Copilot Business和GitHub Copilot Enterprise计划。

创建 automation

  1. 在 GitHub 上,导航到存储库的主页面。

  2. 在存储库名称下,单击 智能体

  3. 在边栏中,单击 Automations

  4. 单击“ 新建”。

  5. 为automation输入名称

  6. 选择一个或多个 触发器 ,确定 automation 何时运行:

    • 按计划:选择重复间隔,可选每小时、每天或每周。
    •           **创建问题时**:每次在存储库中创建问题时,automation 都会运行。
      
    • 创建拉取请求时:automation 会在存储库中每次创建拉取请求时运行。
    •           **当拉取请求同步时**:每次在存储库中将新提交推送到拉取请求时,automation 都会运行。
      

    还可以为问题和拉取请求触发器配置筛选器:

    • 若是在创建问题时,请添加搜索查询筛选器。
    • 对于 打开拉取请求时 以及 同步拉取请求时 这两种情况,请添加搜索查询筛选条件,以及针对拉取请求中已更改文件的筛选条件。
  7. 提示 字段中,描述每次运行时要 Copilot 执行 automation 的任务。

    例如: Label this issue as a bug, an enhancement, or other, based on its content.

    警告

    由 Copilot cloud agent 启动的 automation 会话对其他有权访问该存储库的人可见。 不要在提示中包含机密或其他敏感信息。 若要授予 Copilot 对敏感值的访问权限,请使用存储库机密。 请参阅“为 Copilot 云代理配置机密和变量”。

  8. (可选)选择要使用的****Copilot。 请参阅“更改 GitHub Copilot 云代理的 AI 模型”。

  9. 选择在 Copilot 运行时可使用的工具automation,例如推送更改、更新问题标签或创建拉取请求。

    仅选择任务所需的工具。 您选择的工具决定了 Copilot 在您的存储库中可以执行哪些操作。 (可选)可以使用“ 建议工具 ”按钮根据提示询问 Copilot 建议工具。 请参阅“关于 Copilot 自动化”。

  10. 单击“automation”保存。****

测试 automation。

可以立即运行一个 automation ,而无需等待其触发器触发,以检查它是否按预期运行。

  1. automation从Automations 窗格中打开要测试的控件。
  2. 单击“ 立即运行 ”按钮。 Copilot 启动一个 Copilot cloud agent 会话,并使用所选工具运行 automation 的提示。 可以打开会话以跟踪其进度并查看其所做的任何更改。

管理你的 Automations

你的 automations 是你自己私有的,但对于你的自动化启动的会话,所有具有该存储库读取权限的用户都能看到。

在存储库中的 Automations 窗格中,您可以:

  • 查看你在存储库中的 automations 及其启动的会话。
  • 编辑automation以更改其名称、提示、触发器、工具或模型。
  • 禁用 automation 以使其停止运行,或稍后重新启用它。
  • 删除不再需要的项 automation 。

若要查看每个存储库中的所有 automations 内容,并导航到管理每个存储库,请使用 Automations 用户级别的视图。

延伸阅读