Skip to content

Commit 3c5b32e

Browse files
Copilotkbukum1mchammer01
authored
Document update-types support in allow block for dependabot.yml (#60517)
Co-authored-by: kbukum1 <kbukum1@github.com> Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
1 parent dde5ca8 commit 3c5b32e

File tree

3 files changed

+86
-3
lines changed

3 files changed

+86
-3
lines changed

content/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/controlling-dependencies-updated.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ For more information, see `allow` in [AUTOTITLE](/code-security/dependabot/worki
133133
By default, {% data variables.product.prodname_dependabot %} creates version update pull requests only for the dependencies that are explicitly defined in a manifest (`direct` dependencies). This configuration uses `allow` to tell {% data variables.product.prodname_dependabot %} that we want it to maintain `all` types of dependency. That is, both the `direct` dependencies and their dependencies (also known as indirect dependencies, sub-dependencies, or transient dependencies). In addition, the configuration tells {% data variables.product.prodname_dependabot %} to ignore all dependencies with a name matching the pattern `org.xwiki.*` because we have a different process for maintaining them.
134134

135135
> [!TIP]
136-
> {% data variables.product.prodname_dependabot %} checks for all **allowed** dependencies, then filters out any **ignored** dependencies. If a dependency is matched by an **allow** and an **ignore** statement, then it is ignored.
136+
> {% data variables.product.prodname_dependabot %} checks for all **allowed** dependencies, then filters out any **ignored** dependencies. If a dependency is matched by an **allow** and an **ignore** statement, then it is ignored.{% ifversion dependabot-allow-update-types %} You can also use `update-types` in `allow` rules to restrict updates to specific semantic versioning levels.{% endif %}
137137

138138
```yaml copy
139139
version: 2
@@ -167,6 +167,58 @@ updates:
167167
open-pull-requests-limit: 15
168168
```
169169

170+
{% ifversion dependabot-allow-update-types %}
171+
172+
## Allowing specific semantic versioning levels for updates
173+
174+
You can use `update-types` with `allow` to restrict updates to specific semantic versioning (SemVer) levels. This is useful when you want to be explicit about which types of updates Dependabot should create pull requests for.
175+
176+
> [!NOTE]
177+
> `update-types` only affects _version_ updates, not _security_ updates. Security updates will always be created regardless of the `update-types` setting.
178+
179+
For more information, see `update-types` in [AUTOTITLE](/code-security/dependabot/working-with-dependabot/dependabot-options-reference#update-types-allow).
180+
181+
Here are some examples showing how `update-types` can be used with `allow`.
182+
183+
* To allow only minor and patch updates for a specific dependency, you can combine `update-types` with `dependency-name`.
184+
185+
```yaml copy
186+
version: 2
187+
updates:
188+
- package-ecosystem: "maven"
189+
directory: "/"
190+
schedule:
191+
interval: "weekly"
192+
allow:
193+
- dependency-name: "io.micrometer:micrometer-core"
194+
update-types:
195+
- "version-update:semver-minor"
196+
- "version-update:semver-patch"
197+
```
198+
199+
* To apply different update policies for production and development dependencies, you can combine `update-types` with `dependency-type`.
200+
201+
```yaml copy
202+
version: 2
203+
updates:
204+
- package-ecosystem: "composer"
205+
directory: "/"
206+
schedule:
207+
interval: "monthly"
208+
allow:
209+
- dependency-type: "production"
210+
update-types:
211+
- "version-update:semver-patch"
212+
- dependency-type: "development"
213+
update-types:
214+
- "version-update:semver-minor"
215+
- "version-update:semver-patch
216+
```
217+
218+
In this example, production dependencies will only receive patch updates, while development dependencies will receive both minor and patch updates.
219+
220+
{% endif %}
221+
170222
## Ignoring specific versions or ranges of versions
171223

172224
You can use `versions` in conjunction with `ignore` to ignore specific versions or ranges of versions.
@@ -201,7 +253,8 @@ For more information, see `versions` in [AUTOTITLE](/code-security/dependabot/wo
201253

202254
## Specifying the semantic versioning level to ignore
203255

204-
You can specify one or more semantic versioning (SemVer) levels to ignore using `update-types`.
256+
257+
You can specify one or more semantic versioning (SemVer) levels to ignore using `update-types` with `ignore`.{% ifversion dependabot-allow-update-types %} Alternatively, you can use `update-types` with `allow` to explicitly specify which update levels to allow, see [Allowing specific semantic versioning levels for updates](#allowing-specific-semantic-versioning-levels-for-updates).{% endif %}
205258

206259
For more information, see `update-types` in [AUTOTITLE](/code-security/dependabot/working-with-dependabot/dependabot-options-reference#update-types-ignore).
207260

content/code-security/reference/supply-chain-security/dependabot-options-reference.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ When `allow` is specified {% data variables.product.prodname_dependabot %} uses
8181
|------------|---------|
8282
| `dependency-name` | Allow updates for dependencies with matching names, optionally using `*` to match zero or more characters. |
8383
| `dependency-type` | Allow updates for dependencies of specific types. |
84+
| {% ifversion dependabot-allow-update-types %} |
85+
| `update-types` | Allow updates to one or more semantic versioning levels. Supported values: `version-update:semver-patch`, `version-update:semver-minor`, and `version-update:semver-major`. |
86+
| {% endif %} |
8487

8588
### `dependency-name` (`allow`)
8689

@@ -101,6 +104,26 @@ For most package managers, you should define a value that will match the depende
101104
| `production` | `bundler`, `composer`, `mix`, `maven`, `npm`, `pip`{% ifversion dependabot-uv-support %}, `uv`{% endif %} (not all managers) | Only to dependencies defined by the package manager as production dependencies. |
102105
| `development`| `bundler`, `composer`, `mix`, `maven`, `npm`, `pip`{% ifversion dependabot-uv-support %}, `uv`{% endif %} (not all managers) | Only to dependencies defined by the package manager as development dependencies. |
103106

107+
{% ifversion dependabot-allow-update-types %}
108+
109+
### `update-types` (`allow`)
110+
111+
`update-types` only affects _version_ updates, not _security updates_.
112+
113+
Specify which semantic versions (SemVer) to allow.
114+
115+
SemVer is an accepted standard for defining versions of software packages, in the form `x.y.z`. {% data variables.product.prodname_dependabot %} assumes that versions in this form are always `major.minor.patch`. The `update-types` value is a list of one or more strings.
116+
117+
* Use `version-update:semver-patch` to allow patch releases.
118+
* Use `version-update:semver-minor` to allow minor releases.
119+
* Use `version-update:semver-major` to allow major releases.
120+
121+
When `update-types` is omitted from an `allow` rule, all update types are allowed for that rule.
122+
123+
You can combine `update-types` with `dependency-name` or `dependency-type` to further narrow allowed updates. For examples of how you can combine these options, see [AUTOTITLE](/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/controlling-dependencies-updated#allowing-specific-semantic-versioning-levels-for-updates).
124+
125+
{% endif %}
126+
104127
## `assignees` {% octicon "versions" aria-label="Version updates" height="24" %} {% octicon "shield-check" aria-label="Security updates" height="24" %}
105128

106129
Specify individual assignees for all pull requests raised for a package ecosystem. For examples, see [AUTOTITLE](/code-security/dependabot/dependabot-version-updates/customizing-dependabot-prs).
@@ -351,7 +374,7 @@ When `ignore` is used {% data variables.product.prodname_dependabot %} uses the
351374
|------------|---------|
352375
| `dependency-name` | Ignore updates for dependencies with matching names, optionally using `*` to match zero or more characters. |
353376
| `versions` | Ignore specific versions or ranges of versions. |
354-
| `update-types` | Ignore updates to one or more semantic versioning levels. Supported values: `version-update:semver-minor`, `version-update:semver-patch`, and `version-update:semver-major`. |
377+
| `update-types` | Ignore updates to one or more semantic versioning levels. Supported values: `version-update:semver-patch`, `version-update:semver-minor`, and `version-update:semver-major`. |
355378

356379
### `dependency-name` (`ignore`)
357380

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# References:
2+
# Issue docs-content#21952 - Document update-types support in allow block
3+
# Core: https://github.com/dependabot/dependabot-core/pull/12925
4+
versions:
5+
fpt: '*'
6+
ghec: '*'
7+
ghes: '>3.21'

0 commit comments

Comments
 (0)