多生态系统更新允许您将不同软件包生态系统的 Dependabot 拉取请求合并为每组一个单一的 PR。参见 多生态系统更新。
先决条件
- 具有多个软件包生态系统依赖项的仓库
- 已有
.github/dependabot.yml文件。参见 配置 Dependabot 版本更新。
1. 在 .github/dependabot.yml 文件中定义您的多生态系统组
首先在顶层的 multi-ecosystem-groups 部分定义一个带有调度的组
version: 2
multi-ecosystem-groups:
infrastructure:
schedule:
interval: "weekly"
updates:
# Your existing package ecosystems will go here
version: 2
multi-ecosystem-groups:
infrastructure:
schedule:
interval: "weekly"
updates:
# Your existing package ecosystems will go here
2. 将生态系统分配到该组
在您的软件包生态系统配置中添加 multi-ecosystem-groups 键和 patterns。
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"
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. 使用其他键进行自定义(可选)
您可以为多生态系统组添加标签、审查者或其他配置选项。参见 assignees 和 labels。
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"
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. 验证您的配置
提交更改后,您可以验证配置
- 导航至仓库的 Insights 选项卡。
- 选择 Dependency graph,随后选择 Dependabot。
- 确认您的多生态系统组出现在列表中。
下次计划更新运行时,您将收到一个包含该组所有生态系统更新的单一拉取请求。
故障排除
如果未看到合并的拉取请求,请确保
patterns键已为每个生态系统定义(在使用multi-ecosystem-group时必需)。- 所有生态系统在
multi-ecosystem-group字段中使用相同的组名。