{"meta":{"title":"使用 Copilot 云代理创建自动化","intro":"创建和管理 automations 以按计划运行 Copilot cloud agent 或响应事件。","product":"GitHub Copilot","breadcrumbs":[{"href":"/zh/copilot","title":"GitHub Copilot"},{"href":"/zh/copilot/how-tos","title":"操作方法"},{"href":"/zh/copilot/how-tos/use-copilot-agents","title":"使用Copilot代理"},{"href":"/zh/copilot/how-tos/use-copilot-agents/cloud-agent","title":"Cloud agent"},{"href":"/zh/copilot/how-tos/use-copilot-agents/cloud-agent/create-automations","title":"创建云自动化"}],"documentType":"article"},"body":"# 使用 Copilot 云代理创建自动化\n\n创建和管理 automations 以按计划运行 Copilot cloud agent 或响应事件。\n\n## Introduction\n\n使用 automations，您可以将 Copilot cloud agent 设置为自动运行，可以按计划运行，也可以在响应存储库中的事件时运行。\nAutomations 可以在其配置所在的仓库中执行操作，例如发起拉取请求或为议题添加标签。\n\n可以从 automations 上存储库的“智能体”\\*\\*\\*\\* 选项卡中创建和管理 GitHub。 还可以在automations的**Automations** 选项卡中创建和管理GitHub Copilot app。\n\n有关触发器、工具、可见性和安全性的概述 automations，请参阅 [关于 Copilot 自动化](/zh/copilot/concepts/agents/cloud-agent/about-automations)。\n\n## 先决条件\n\n若要 automations 在存储库中可用，以下所有内容都必须为 true：\n\n* 存储库必须是 **专用存储库或内部**存储库。\n  Automations 在公共存储库中不可用。\n* 必须为该存储库启用 Copilot cloud agent。 如果您拥有 Copilot Business 或 Copilot Enterprise，则管理员必须启用 Copilot cloud agent 策略。 请参阅“[管理对 GitHub Copilot 云代理的访问权限](/zh/copilot/concepts/agents/cloud-agent/access-management)”。\n* 组织必须在存储库中同时允许 Copilot cloud agent 和 automations（二者默认均处于启用状态）。 请参阅“[将GitHub Copilot云代理添加到组织](/zh/copilot/how-tos/administer-copilot/manage-for-organization/add-copilot-cloud-agent)”。\n\nAutomations可用于GitHub Copilot Pro、GitHub Copilot Pro+、GitHub Copilot Max、GitHub Copilot Business和GitHub Copilot Enterprise计划。\n\n## 创建 automation\n\n1. 在 GitHub 上，导航到存储库的主页面。\n\n2. 在存储库名称下，单击 **<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-agent\" aria-label=\"agent\" role=\"img\"><path d=\"M14.5 8.9v-.052A2.956 2.956 0 0 0 11.542 5.9a.815.815 0 0 1-.751-.501l-.145-.348A3.496 3.496 0 0 0 7.421 2.9h-.206a3.754 3.754 0 0 0-3.736 4.118l.011.121a.822.822 0 0 1-.619.879A1.81 1.81 0 0 0 1.5 9.773v.14c0 1.097.89 1.987 1.987 1.987H4.5a.75.75 0 0 1 0 1.5H3.487A3.487 3.487 0 0 1 0 9.913v-.14C0 8.449.785 7.274 1.963 6.75A5.253 5.253 0 0 1 7.215 1.4h.206a4.992 4.992 0 0 1 4.586 3.024A4.455 4.455 0 0 1 16 8.848V8.9a.75.75 0 0 1-1.5 0Z\"></path><path d=\"m8.38 7.67 2.25 2.25a.749.749 0 0 1 0 1.061L8.38 13.23a.749.749 0 1 1-1.06-1.06l1.719-1.72L7.32 8.731A.75.75 0 0 1 8.38 7.67ZM15 13.45h-3a.75.75 0 0 1 0-1.5h3a.75.75 0 0 1 0 1.5Z\"></path></svg>智能体**。\n\n3. 在边栏中，单击 **Automations**。\n\n4. 单击“ **新建**”。\n\n5. 为automation输入**名称**。\n\n6. 选择一个或多个 **触发器** ，确定 automation 何时运行：\n\n   * **按计划**：选择重复间隔，可选每小时、每天或每周。\n   * ```\n               **创建问题时**：每次在存储库中创建问题时，automation 都会运行。\n     ```\n   * **创建拉取请求时**：automation 会在存储库中每次创建拉取请求时运行。\n   * ```\n               **当拉取请求同步时**：每次在存储库中将新提交推送到拉取请求时，automation 都会运行。\n     ```\n\n   还可以为问题和拉取请求触发器配置筛选器：\n\n   * 若是在**创建问题**时，请添加搜索查询筛选器。\n   * 对于 **打开拉取请求时** 以及 **同步拉取请求时** 这两种情况，请添加搜索查询筛选条件，以及针对拉取请求中已更改文件的筛选条件。\n\n7. 在 **提示** 字段中，描述每次运行时要 Copilot 执行 automation 的任务。\n\n   例如： `Label this issue as a bug, an enhancement, or other, based on its content.`\n\n   > \\[!WARNING]\n   > 由 Copilot cloud agent 启动的 automation 会话对其他有权访问该存储库的人可见。 不要在提示中包含机密或其他敏感信息。 若要授予 Copilot 对敏感值的访问权限，请使用存储库机密。 请参阅“[为 Copilot 云代理配置机密和变量](/zh/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/configure-secrets-and-variables)”。\n\n8. （可选）选择要使用的\\*\\*\\*\\*Copilot。 请参阅“[更改 GitHub Copilot 云代理的 AI 模型](/zh/copilot/how-tos/use-copilot-agents/cloud-agent/changing-the-ai-model)”。\n\n9. 选择在 Copilot 运行时可使用的**工具**automation，例如推送更改、更新问题标签或创建拉取请求。\n\n   仅选择任务所需的工具。 您选择的工具决定了 Copilot 在您的存储库中可以执行哪些操作。 （可选）可以使用“ **建议工具** ”按钮根据提示询问 Copilot 建议工具。 请参阅“[关于 Copilot 自动化](/zh/copilot/concepts/agents/cloud-agent/about-automations#tools-and-actions)”。\n\n10. 单击“automation”保存。\\*\\*\\*\\*\n\n## 测试 automation。\n\n可以立即运行一个 automation ，而无需等待其触发器触发，以检查它是否按预期运行。\n\n1. automation从**Automations** 窗格中打开要测试的控件。\n2. 单击“ **立即运行** ”按钮。\n   Copilot 启动一个 Copilot cloud agent 会话，并使用所选工具运行 automation 的提示。 可以打开会话以跟踪其进度并查看其所做的任何更改。\n\n## 管理你的 Automations\n\n你的 automations 是你自己私有的，但对于你的自动化启动的会话，所有具有该存储库读取权限的用户都能看到。\n\n在存储库中的 **Automations** 窗格中，您可以：\n\n* 查看你在存储库中的 automations 及其启动的会话。\n* 编辑automation以更改其名称、提示、触发器、工具或模型。\n* 禁用 automation 以使其停止运行，或稍后重新启用它。\n* 删除不再需要的项 automation 。\n\n若要查看每个存储库中的所有 automations 内容，并导航到管理每个存储库，请使用 Automations 用户级别的视图。\n\n## 延伸阅读\n\n* [关于 Copilot 自动化](/zh/copilot/concepts/agents/cloud-agent/about-automations)\n* [启动GitHub Copilot会话](/zh/copilot/how-tos/use-copilot-agents/cloud-agent/start-copilot-sessions)\n* [GitHub Copilot云代理的风险和缓解措施](/zh/copilot/concepts/agents/cloud-agent/risks-and-mitigations)"}