{"meta":{"title":"GitHub Actions 运行器上的 Dependabot","intro":"如果你为存储库启用了 GitHub，Dependabot 会自动在 GitHub Actions 上运行生成 GitHub Actions 拉取请求的工作。 启用 Dependabot 后，这些作业将在运行时绕过存储库或组织级别的 Actions 策略检查和禁用限制。","product":"安全性和代码质量","breadcrumbs":[{"href":"/zh/code-security","title":"安全性和代码质量"},{"href":"/zh/code-security/concepts","title":"Concepts"},{"href":"/zh/code-security/concepts/supply-chain-security","title":"供应链安全"},{"href":"/zh/code-security/concepts/supply-chain-security/dependabot-on-actions","title":"Actions 上的 Dependabot"}],"documentType":"article"},"body":"# GitHub Actions 运行器上的 Dependabot\n\n如果你为存储库启用了 GitHub，Dependabot 会自动在 GitHub Actions 上运行生成 GitHub Actions 拉取请求的工作。 启用 Dependabot 后，这些作业将在运行时绕过存储库或组织级别的 Actions 策略检查和禁用限制。\n\n## 关于 Dependabot 运行器上的 GitHub Actions\n\n> \\[!IMPORTANT]\n> 如果为仓库启用了 Dependabot，它将始终在 GitHub Actions 上运行，**并绕过 Actions 策略检查以及仓库或组织级别的禁用设置**。 这可确保在启用 Dependabot 时始终运行安全和版本更新工作流。\n\n使用 GitHub Actions 运行器可以更轻松地识别 Dependabot 作业错误，并手动检测和排查失败的作业。 你还可以通过将 Dependabot 集成到你的 CI/CD 管道中，使用 GitHub Actions API 和 Webhook 来检测 Dependabot 作业状态，如失败的运行，并执行下游处理。 有关详细信息，请参阅 [GitHub Actions 的 REST API 端点](/zh/rest/actions) 和 [Webhook 事件和有效负载](/zh/webhooks/webhook-events-and-payloads)。\n\n如果你在用户帐户或组织中创建的新存储库满足以下任一条件，它们将自动配置为在 Dependabot 上使用标准 GitHub Actions 托管运行器运行 GitHub：\n\n* Dependabot 已安装并启用，并且 GitHub Actions 已启用且正在使用中。\n* 你的组织的“Dependabot运行器上的 GitHub Actions”设置已启用。\n\nGitHub的未来版本将移除禁用在Dependabot上运行GitHub Actions的功能。\n\n> \\[!NOTE] 在 Dependabot 上启用 GitHub Actions 可能会增加你帐户中运行的并发作业数量。 如果需要，使用企业计划的客户可请求更高的并发作业数限制。 如需了解更多信息，请通过[GitHub 支持门户](https://support.github.com/)联系我们，或联系您的销售代表。\n\n## 动态工作流\n\n若要在Dependabot上运行GitHub Actions作业，GitHub会为每个作业创建一个动态工作流。 与标准 GitHub Actions 工作流不同，动态工作流是为特定运行生成的，并且不会存储在存储库的 `.github/workflows` 目录中。\n\n你可能会看到名为 `dynamic/dependabot/dependabot-updates` 的工作流运行，或者名称后附加了 `(dynamic)` 的检查运行。 可以使用工作流运行日志来排查错误或配置问题。\n\n你可能会看到名称为 `dynamic/dependabot/dependabot-updates` 的工作流运行，或名称后附加了 `(dynamic)` 的检查运行。 若要排查错误或配置问题，请在存储库的 **“操作** ”选项卡上筛选工作流运行以仅 Dependabot 显示更新作业，然后打开工作流运行以查看日志。\n\n## 运行器选项\n\n## 运行器选项\n\n您可以使用以下方式在Dependabot上运行GitHub Actions：\n\n* **标准 GitHub 托管运行器。** 这些是用于 GitHub 执行 GitHub Actions 作业的默认运行程序。\n* **大型运行器。** 这些是 GitHub托管运行程序，具有更多 RAM、CPU 和磁盘空间等高级功能。 有关详细信息，请参阅“[使用较大运行器](/zh/actions/how-tos/manage-runners/larger-runners)”。\n* **自托管运行器。** 这些运行器让你更好地控制 Dependabot 对私有注册表和内部网络资源的访问。 请注意，出于安全原因，Dependabot updates 在自托管运行器上不会在公共存储库上运行。 有关在自托管运行程序上分配 `dependabot` 标签的详细信息，请参阅 [在自托管运行器上配置 Dependabot](/zh/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/configure-on-self-hosted-runners)。\n\n在标准 Dependabot 托管运行器或自托管运行器上运行 GitHub**不**计入你包含的 GitHub Actions 分钟数。 对于 Dependabot 上的 大型运行器，GitHub 将按标准费率向贵组织计费。 请参阅“[Actions 运行程序定价](/zh/billing/reference/actions-runner-pricing)”。\n\n> \\[!NOTE]\n> 对于 Dependabot 上的 GitHub Actions，私有网络功能支持配合 Azure 虚拟网络 (VNET) 或 Actions Runner Controller (ARC) 使用。 请参阅“[设置 Dependabot 以使用 Actions Runner Controller 在自托管操作运行器上运行](/zh/code-security/tutorials/secure-your-dependencies/setting-dependabot-to-run-on-self-hosted-runners-using-arc)”和“[使用Azure专用网络设置 Dependabot 以在 github 托管的操作运行程序上运行](/zh/code-security/how-tos/secure-at-scale/configure-enterprise-security/configure-specific-tools/setting-dependabot-to-run-on-github-hosted-runners-using-vnet)”。\n\n## 运行器设置如何交互\n\nDependabot 运行器上的 GitHub Actions 和自托管运行器设置上的 Dependabot 是相互依存的：\n\n* 启用“自托管运行器上的 Dependabot”会自动启用“Dependabot 运行器上的 GitHub Actions”。 禁用“Dependabot 运行器上的 GitHub Actions”会自动禁用“自托管运行器上的 Dependabot”。\n* 当两个设置都启用时，Dependabot 作业**仅**在自托管运行器或带有 大型运行器 标签的 `dependabot` 上运行 — 不在标准 GitHub 托管运行器上运行。\n\n> \\[!WARNING]\n> 如果两个设置都启用，但没有可用的自托管运行器或带有 大型运行器 标签的 `dependabot`，Dependabot 作业将无限期地保持排队状态。 在启用“自托管运行器上的 Dependabot”之前，确保配置了带有此标签的运行器。\n\n## 访问和权限\n\n如果要转换到在 Dependabot 运行程序上使用 GitHub Actions ，并且限制对组织的或存储库专用资源的访问，则可能需要更新允许的 IP 地址列表。 例如，如果你目前将私有资源的访问限制在 Dependabot 使用的 IP 地址，你应该更新你的允许列表，以使用源自元 API 终结点的 GitHub 托管运行器 IP 地址。 有关详细信息，请参阅“[元数据的 REST API 端点](/zh/rest/meta)”。\n\n## 后续步骤\n\n若要在 Dependabot 运行器上启用 GitHub Actions，请参阅 [在 GitHub 托管的运行程序上配置 Dependabot](/zh/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/configure-on-github-hosted-runners) 和 [在自托管运行器上配置 Dependabot](/zh/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/configure-on-self-hosted-runners)。"}