Skip to main content

关于 GitHub Actions 运行程序上的 Dependabot

GitHub automatically runs the jobs that generate Dependabot pull requests on GitHub Actions if you have GitHub Actions enabled for the repository. When Dependabot is enabled, these jobs will run by bypassing Actions policy checks and disablement at the repository or organization level.

谁可以使用此功能?

对于启用了 GitHub Actions 的所有存储库,GitHub Actions 上的 Dependabot 默认启用

关于 GitHub Actions 运行程序上的 Dependabot

重要

如果为存储库启用了 Dependabot,它将始终在 GitHub Actions 上运行,并绕过存储库或组织级别的操作策略检查和禁用。 这可确保在启用 Dependabot 时始终运行安全和版本更新工作流。

使用 GitHub Actions 运行程序可以更轻松地识别 Dependabot 作业错误,并手动检测和排查失败的运行。 还可以使用 GitHub Actions API 和 Webhook 将 Dependabot 集成到 CI/CD 管道中,以检测 Dependabot 作业状态(例如运行失败),并执行下游处理。 有关详细信息,请参阅 GitHub Actions 的 REST API 端点Webhook 事件和有效负载

如果以下任何一项为 true,则你在用户帐户或组织中创建的新存储库将自动配置为使用标准 GitHub 托管的运行器在 GitHub Actions 上运行 Dependabot:

  • Dependabot 已安装并启用,GitHub Actions 已启用且正在使用中。
  • 为组织启用“GitHub Actions 运行程序上的 Dependabot”设置。

GitHub 的未来版本将移除在 GitHub Actions 上禁用运行 Dependabot 的功能。

注意

在 GitHub Actions 上启用 Dependabot 可能会增加帐户中运行的并发作业数。 如果需要,使用企业计划的客户可请求更高的并发作业数限制。 有关详细信息,请通过 GitHub 支持门户 联系我们,或联系销售代表。

运行器选项

可以使用以下方法在 GitHub Actions 上运行 Dependabot: * GitHub 托管的标准运行器。 这些是 GitHub 用于执行 GitHub Actions 作业的默认运行器。 * 大型运行器。 这些是由 GitHub 托管的运行器,具有诸如更多 RAM、CPU 和磁盘空间等高级功能。 有关详细信息,请参阅“使用较大运行器”。 * 自托管运行器。 这些运行器授予你对 Dependabot 访问专用注册表和内部网络资源的更大控制权。 请注意,出于安全原因,自托管运行器上的 Dependabot updates 将不会在公共存储库上运行。 有关在自托管运行程序上分配 dependabot 标签的详细信息,请参阅 在自托管运行器上配置 Dependabot

在 GitHub 托管的标准运行器或自托管运行器上运行 Dependabot,不会计入你包含的 GitHub Actions 分钟数。 对于 大型运行器 上的 Dependabot,GitHub 将按常规费率向你的组织收费。 请参阅“Actions 运行程序定价”。

注意

Azure 虚拟网络(VNET)或 Actions Runner Controller(ARC)支持 Dependabot 在 GitHub Actions 上的专用网络。 请参阅“设置 Dependabot 以使用 Actions Runner Controller 在自托管操作运行器上运行”和“设置 Dependabot 以使用 Azure 专用网络在 GitHub 托管的操作运行程序上运行”。

运行器设置如何交互

GitHub Actions 运行器上的 Dependabot 和自托管运行器设置上的 Dependabot 相互依存:

  • 启用“自托管运行器上的 Dependabot”会自动启用“GitHub Actions 运行器上的 Dependabot”。 禁用“GitHub Actions 运行器上的 Dependabot”会自动禁用“自托管运行器上的 Dependabot”。
  • 当这两个设置都启用时,Dependabot 作业在自托管运行器或带有 dependabot 标签的 大型运行器 上运行,而在 GitHub 托管的标准运行器上则不运行。

警告

如果启用这两个设置,但没有自托管运行器或带有 dependabot 标签的大型运行器 可用,那么 Dependabot 作业将会无限期排队。 在启用“自托管运行器上的 Dependabot”之前,请确保已配置具有此标签的运行器。

访问和权限

如果要在 GitHub Actions 运行程序上使用 Dependabot,并且限制对组织或存储库的专用资源的访问,则可能需要更新允许的 IP 地址列表。 例如,如果当前将对专用资源的访问权限限制为 Dependabot 使用的 IP 地址,则应更新允许列表以使用源自元 API 终结点的 GitHub 托管的运行程序 IP 地址。 有关详细信息,请参阅“元数据的 REST API 端点”。

强制实施策略以仅允许企业中的操作和可重用工作流,并且对 GitHub Actions 启用 Dependabot 时,Dependabot 将不会运行。 若要使 Dependabot 能够与企业操作和可重用工作流一起运行,应选择允许 GitHub 创建的操作,或允许指定的操作和可重用工作流。 有关详细信息,请参阅“在企业中强制实施GitHub Actions策略”。

后续步骤

若要在 GitHub Actions 运行器上启用 Dependabot,请参阅 在 GitHub 托管的运行程序上配置 Dependabot在自托管运行器上配置 Dependabot