跳至主要内容

在 GitHub 托管的运行程序上配置 Dependabot

在 GitHub 托管的运行程序上启用 Dependabot,可更轻松地识别 Dependabot 作业错误,并手动检测和排查失败的运行。

谁可以使用此功能?

组织所有者和仓库管理员

在标准 GitHub 托管的运行程序上启用或禁用 Dependabot

您可以在标准 GitHub 托管的运行程序上配置 Dependabot

如果您限制对组织或仓库私有资源的访问,可能需要在启用 Dependabot 于 GitHub Actions 运行程序之前更新允许的 IP 地址列表。您可以将 IP 允许列表更新为使用 GitHub 托管的运行程序 IP 地址(而非 Dependabot IP 地址),这些地址来源于 meta REST API 端点。

警告

您不应依赖 GitHub Actions 的 IP 地址来进行私有注册表的身份验证。这些 GitHub Actions 地址不仅被 GitHub 使用,不应被信任用于身份验证。相反,请使用自托管运行程序,以确保对网络访问有更大的控制。更多信息,请参见 在自托管运行程序上配置 Dependabot

针对您的仓库

  1. 在 GitHub 上,导航至仓库的主页面。

  2. 在仓库名称下,点击 设置。如果看不到 “Settings” 选项卡,请选择 下拉菜单,然后点击 设置

    Screenshot of a repository header showing the tabs. The "Settings" tab is highlighted by a dark orange outline.

  3. 在侧边栏的Security部分,点击 Advanced Security

  4. 在 “Dependabot” 部分,位于 “Dependabot on Actions runners” 右侧,点击 Enable 启用此功能或点击 Disable 禁用它。

    注意

    GitHub Actions 上的 Dependabot 依赖 ubuntu-latest 标签来选择合适的运行程序。为确保 Dependabot 在 GitHub 托管的运行程序上运行,不应在自托管运行程序上使用 ubuntu-latest 标签。

针对您的组织

仅满足以下条件的仓库将在下次触发 Dependabot 作业时被更新为在 GitHub Actions 上运行 Dependabot。

  • 仓库已启用 Dependabot。
  • 仓库已启用 GitHub Actions。

如果您组织中的某个仓库启用了 Dependabot 但禁用了 GitHub Actions,Dependabot 将不会在 GitHub Actions 上运行,而是继续使用内置的 Dependabot 应用程序运行。

  1. 在 GitHub 的右上角,点击您的头像,然后点击 Organizations

  2. 点击即可选择组织。

  3. 在组织名称下,点击 设置。如果看不到 “Settings” 选项卡,请选择 下拉菜单,然后点击 设置

    Screenshot of the tabs in an organization's profile. The "Settings" tab is outlined in dark orange.

  4. 在侧边栏的 “Security” 部分,点击 高级安全,然后点击 全局设置

  5. 在 “Dependabot” 部分,位于 “Runner type” 旁边,确认已选择 “Standard GitHub runner”。如果没有,请点击并更新您的配置。

    注意

    GitHub Actions 上的 Dependabot 依赖 ubuntu-latest 标签来选择合适的运行程序。为确保 Dependabot 在 GitHub 托管的运行程序上运行,不应在自托管运行程序上使用 ubuntu-latest 标签。

在更大运行程序上启用或禁用 Dependabot

如果遇到 Dependabot 超时或内存不足错误,您可能希望使用更大的运行程序,因为可以为这些运行程序配置更多资源。您只能为 Dependabot 在 组织范围内 启用更大的运行程序。

  1. 向您的组织添加更大的运行程序,并确保指定的名称为 dependabot。更多信息,请参见 管理更大的运行程序

  2. 为组织启用自托管运行程序。更多信息,请参见 在自托管运行程序上配置 Dependabot。此步骤是必需的,因为它可确保未来的 Dependabot 作业将在具有 dependabot 名称的更大 GitHub 托管运行程序上运行。

    注意

    GitHub Actions 上的 Dependabot 依赖 ubuntu-latest 标签来选择合适的运行程序。为确保 Dependabot 在 GitHub 托管的运行程序上运行,不应在自托管运行程序上使用 ubuntu-latest 标签。

© . This site is unofficial and not affiliated with GitHub, Inc.