|
| 1 | +--- |
| 2 | +applyTo: "**/*dependabot.yml" |
| 3 | +description: Dependabot configuration patterns and best practices |
| 4 | +--- |
| 5 | + |
| 6 | +# Dependabot Configuration |
| 7 | + |
| 8 | +Guidelines for configuring Dependabot version updates. |
| 9 | + |
| 10 | +## Basic Structure |
| 11 | + |
| 12 | +```yaml |
| 13 | +version: 2 |
| 14 | +updates: |
| 15 | + - package-ecosystem: "gomod" # or npm, pip, docker, github-actions, etc. |
| 16 | + directory: "/" |
| 17 | + schedule: |
| 18 | + interval: "weekly" # daily, weekly, or monthly |
| 19 | +``` |
| 20 | +
|
| 21 | +## Cooldown Settings |
| 22 | +
|
| 23 | +Configure cooldown periods to delay updates until packages have matured. This helps avoid churn from rapid releases. Cooldown only applies to version updates, not security updates. |
| 24 | +
|
| 25 | +```yaml |
| 26 | +cooldown: |
| 27 | + default-days: 7 # Default cooldown for all updates |
| 28 | + semver-major-days: 7 # Major version updates wait 7 days |
| 29 | + semver-minor-days: 3 # Minor version updates wait 3 days |
| 30 | + semver-patch-days: 1 # Patch version updates wait 1 day |
| 31 | + include: |
| 32 | + - "some-package*" # Only apply cooldown to matching packages |
| 33 | + exclude: |
| 34 | + - "critical-pkg*" # Skip cooldown for these packages |
| 35 | +``` |
| 36 | +
|
| 37 | +**Parameters:** |
| 38 | +
|
| 39 | +| Parameter | Description | |
| 40 | +| ------------------- | ---------------------------------------------------------------- | |
| 41 | +| `default-days` | Default cooldown period for all dependencies | |
| 42 | +| `semver-major-days` | Cooldown for major version updates | |
| 43 | +| `semver-minor-days` | Cooldown for minor version updates | |
| 44 | +| `semver-patch-days` | Cooldown for patch version updates | |
| 45 | +| `include` | List of dependencies to apply cooldown (supports wildcards) | |
| 46 | +| `exclude` | List of dependencies excluded from cooldown (supports wildcards) | |
| 47 | + |
| 48 | +**Notes:** |
| 49 | + |
| 50 | +- If semver-specific days aren't defined, `default-days` is used |
| 51 | +- `exclude` takes precedence over `include` |
| 52 | +- Security updates automatically bypass cooldown |
| 53 | + |
| 54 | +### SemVer Cooldown Support by Ecosystem |
| 55 | + |
| 56 | +**IMPORTANT:** The `semver-major-days`, `semver-minor-days`, and `semver-patch-days` options are NOT supported by all package ecosystems. For unsupported ecosystems, use only `default-days`. |
| 57 | + |
| 58 | +| Ecosystem | SemVer Cooldown Supported | |
| 59 | +| ---------------- | ------------------------------- | |
| 60 | +| `gomod` | ✅ Yes | |
| 61 | +| `npm` | ✅ Yes | |
| 62 | +| `pip` | ✅ Yes | |
| 63 | +| `bundler` | ✅ Yes | |
| 64 | +| `cargo` | ✅ Yes | |
| 65 | +| `composer` | ✅ Yes | |
| 66 | +| `maven` | ✅ Yes | |
| 67 | +| `gradle` | ✅ Yes | |
| 68 | +| `nuget` | ✅ Yes | |
| 69 | +| `docker` | ✅ Yes | |
| 70 | +| `github-actions` | ❌ No - use `default-days` only | |
| 71 | +| `gitsubmodule` | ❌ No - use `default-days` only | |
| 72 | +| `terraform` | ❌ No - use `default-days` only | |
| 73 | + |
| 74 | +**Example for github-actions (no semver support):** |
| 75 | + |
| 76 | +```yaml |
| 77 | +- package-ecosystem: "github-actions" |
| 78 | + directory: "/" |
| 79 | + schedule: |
| 80 | + interval: "weekly" |
| 81 | + cooldown: |
| 82 | + default-days: 7 # Only default-days is supported |
| 83 | +``` |
| 84 | + |
| 85 | +## Grouping Updates |
| 86 | + |
| 87 | +Group related dependencies into single PRs to reduce noise: |
| 88 | + |
| 89 | +```yaml |
| 90 | +updates: |
| 91 | + - package-ecosystem: "gomod" |
| 92 | + directory: "/" |
| 93 | + schedule: |
| 94 | + interval: "weekly" |
| 95 | + groups: |
| 96 | + go-dependencies: |
| 97 | + patterns: |
| 98 | + - "*" # Group all Go dependencies |
| 99 | +``` |
| 100 | + |
| 101 | +You can create multiple groups with specific patterns: |
| 102 | + |
| 103 | +```yaml |
| 104 | +groups: |
| 105 | + aws-sdk: |
| 106 | + patterns: |
| 107 | + - "github.com/aws/*" |
| 108 | + testing: |
| 109 | + patterns: |
| 110 | + - "*test*" |
| 111 | + - "*mock*" |
| 112 | + dependency-type: "development" |
| 113 | +``` |
| 114 | + |
| 115 | +Group parameters: |
| 116 | + |
| 117 | +- `patterns`: Include dependencies matching these patterns |
| 118 | +- `exclude-patterns`: Exclude dependencies matching these patterns |
| 119 | +- `dependency-type`: Limit to `development` or `production` |
| 120 | +- `update-types`: Limit to `minor`, `patch`, or `major` |
| 121 | + |
| 122 | +## Filtering Dependencies |
| 123 | + |
| 124 | +### Allow specific dependency types |
| 125 | + |
| 126 | +```yaml |
| 127 | +allow: |
| 128 | + - dependency-type: "direct" # Only direct dependencies |
| 129 | + - dependency-type: "indirect" # Include transitive dependencies |
| 130 | + - dependency-type: "all" # All dependencies |
| 131 | +``` |
| 132 | + |
| 133 | +### Ignore specific dependencies |
| 134 | + |
| 135 | +```yaml |
| 136 | +ignore: |
| 137 | + - dependency-name: "lodash" |
| 138 | + versions: ["4.x"] # Ignore lodash 4.x updates |
| 139 | + - dependency-name: "aws-sdk" |
| 140 | + update-types: ["version-update:semver-major"] # Ignore major updates |
| 141 | +``` |
| 142 | + |
| 143 | +## Common Ecosystems |
| 144 | + |
| 145 | +| Ecosystem | `package-ecosystem` value | |
| 146 | +| -------------- | ------------------------- | |
| 147 | +| Go modules | `gomod` | |
| 148 | +| npm/Yarn | `npm` | |
| 149 | +| Python pip | `pip` | |
| 150 | +| Docker | `docker` | |
| 151 | +| GitHub Actions | `github-actions` | |
| 152 | +| Terraform | `terraform` | |
| 153 | +| Cargo (Rust) | `cargo` | |
| 154 | +| NuGet (.NET) | `nuget` | |
| 155 | + |
| 156 | +## Complete Example |
| 157 | + |
| 158 | +```yaml |
| 159 | +version: 2 |
| 160 | +updates: |
| 161 | + # Go modules - supports semver cooldown |
| 162 | + - package-ecosystem: "gomod" |
| 163 | + directory: "/" |
| 164 | + schedule: |
| 165 | + interval: "weekly" |
| 166 | + cooldown: |
| 167 | + default-days: 7 |
| 168 | + semver-major-days: 7 |
| 169 | + allow: |
| 170 | + - dependency-type: "direct" |
| 171 | + - dependency-type: "indirect" |
| 172 | + groups: |
| 173 | + go-dependencies: |
| 174 | + patterns: |
| 175 | + - "*" |
| 176 | +
|
| 177 | + # GitHub Actions - does NOT support semver cooldown |
| 178 | + - package-ecosystem: "github-actions" |
| 179 | + directory: "/" |
| 180 | + schedule: |
| 181 | + interval: "weekly" |
| 182 | + cooldown: |
| 183 | + default-days: 7 |
| 184 | + groups: |
| 185 | + github-actions: |
| 186 | + patterns: |
| 187 | + - "*" |
| 188 | +``` |
| 189 | + |
| 190 | +--- |
| 191 | + |
| 192 | +## References |
| 193 | + |
| 194 | +- [Dependabot Configuration Options](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file) - Full configuration reference |
| 195 | +- [Supported Ecosystems](https://docs.github.com/en/code-security/dependabot/ecosystems-supported-by-dependabot/supported-ecosystems-and-repositories) - List of supported package ecosystems |
| 196 | +- [Optimizing PR Creation](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/optimizing-pr-creation-version-updates) - Cooldown and grouping strategies |
0 commit comments