跳至主要内容

配置 Dependabot 的多生态系统更新

通过将多个生态系统的更新分组为单个合并的拉取请求,减少您收到的 Dependabot 拉取请求数量。

谁可以使用此功能?

具有 写入 访问权限的用户

多生态系统更新允许您将不同软件包生态系统的 Dependabot 拉取请求合并为每组一个单一的 PR。参见 多生态系统更新

先决条件

1. 在 .github/dependabot.yml 文件中定义您的多生态系统组

首先在顶层的 multi-ecosystem-groups 部分定义一个带有调度的组

YAML
version: 2

multi-ecosystem-groups:
  infrastructure:
    schedule:
      interval: "weekly"

updates:
  # Your existing package ecosystems will go here

2. 将生态系统分配到该组

在您的软件包生态系统配置中添加 multi-ecosystem-groups 键和 patterns。

YAML
version: 2

multi-ecosystem-groups:
  infrastructure:
    schedule:
      interval: "weekly"

updates:
  - package-ecosystem: "docker"
    directory: "/"
    patterns: ["nginx", "redis", "postgres"]
    multi-ecosystem-group: "infrastructure"

  - package-ecosystem: "terraform"
    directory: "/"
    patterns: ["aws", "terraform-*"]
    multi-ecosystem-group: "infrastructure"

注意

使用 ["*"] 包含所有依赖项。

3. 提交您的更改

将更改提交到您的 dependabot.yml 文件。

4. 使用其他键进行自定义(可选)

您可以为多生态系统组添加标签、审查者或其他配置选项。参见 assigneeslabels

YAML
multi-ecosystem-groups:
  infrastructure:
    schedule:
      interval: "weekly"
    assignees: ["@platform-team"]
    labels: ["infrastructure", "dependencies"]

updates:
  - package-ecosystem: "docker"
    directory: "/"
    patterns: ["nginx", "redis", "postgres"]
    multi-ecosystem-group: "infrastructure"

  - package-ecosystem: "terraform"
    directory: "/"
    patterns: ["aws", "terraform-*"]
    multi-ecosystem-group: "infrastructure"

完整可用选项列表,请参见 Dependabot 选项参考

5. 验证您的配置

提交更改后,您可以验证配置

  1. 导航至仓库的 Insights 选项卡。
  2. 选择 Dependency graph,随后选择 Dependabot
  3. 确认您的多生态系统组出现在列表中。

下次计划更新运行时,您将收到一个包含该组所有生态系统更新的单一拉取请求。

故障排除

如果未看到合并的拉取请求,请确保

  • patterns 键已为每个生态系统定义(在使用 multi-ecosystem-group 时必需)。
  • 所有生态系统在 multi-ecosystem-group 字段中使用相同的组名。

延伸阅读

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