Skip to main content

A faster way to manage version updates with Dependabot

  • Group update PRs by dependency type, patterns, or semantic version update type
  • The latter sounds particularly useful!
  • All patch updates would probably be handy

Excerpts from A faster way to manage version updates with Dependabot by Eric Tooley:

When the next Log4j lands, you don’t want to find out that you’re several versions behind, and that it’s going to take the team days to fix all of the breaking changes. Dependabot version updates automate the patching process, giving you a measure of protection from unwelcome surprises.

But just as with any inbox, the sheer volume of available updates can quickly swell into a management hassle. And given that some types of related dependencies must be updated together–such as with Storybook, Angular, and AWS SDK–it’s all too easy to put off these tasks until it’s too late.

Today’s general availability release is all about making it easier to stay on top of version updates and prevent breaking changes. Previously, Dependabot would open individual pull requests for each update, adding overhead to a developer’s workflow and raising the possibility that related dependencies could fall out of sync. Now, you can specify groups of dependencies to update with a single pull request. Grouped version updates confer significant benefits to your development process: simplified dependency management, a reduced risk of breaking changes, and an opportunity to phase out third-party tools and manual workarounds.

I’ve been testing the grouped Dependabot updates and just wanted to say it is awesome! Grouping functionality and configuration are exactly what we want.

- Nick Gibson, Causeway Capital Management

How it works

To take control of how Dependabot structures its pull requests, you can define groups of dependencies that will be updated together using groups in dependabot.yml. For example, you can configure groups that update many dependencies at once, or groups that minimize the risk of breaking changes.

When you first configure a group, specify a group name that will display in pull request titles and branch names. Then, define other options to include or exclude specific dependencies from the group.

  • dependency-type: specify a dependency type to be included in the group. dependency-type can be development or production.
  • patterns: define strings of characters that match with a dependency name (or multiple dependency names) to include those dependencies in the group.
  • update-type: specify the update type based on semantic versioning (for instance, where 1.2.3 equates to major.minor.patch) to include all updates of the same level in the same group.

You can also exclude dependencies from groups to always manage their updates individually:

  • exclude-patterns: define strings of characters that match with a dependency name to exclude them from a group. For these dependencies, Dependabot will continue to raise single pull requests to update the dependency to its latest version.

Bear in mind that you can only create groups for version updates.

Example 1: Group by dependency-typeIn this example, “production” and “development” dependencies are grouped together, excluding those that match the pattern “rubocop*”:

# \`dependabot.yml\` file using the \`dependency-type\` option to group updates
# in conjunction with \`patterns\` and \`exclude-patterns\`.
 
groups:
  production-dependencies:
    dependency-type: "production"
  development-dependencies:
    dependency-type: "development"
    exclude-patterns:
    - "rubocop*"
  rubocop:
    patterns:
    - "rubocop*"

Example 2: Group by patternsIn this example, a group named dev-dependencies will update dependencies in the bundler ecosystem at a weekly interval:

# \`dependabot.yml\` file with customized bundler configuration
# In this example, the name of the group is \`dev-dependencies\`, and
# only the \`patterns\` and \`exclude-patterns\` options are used.
version: 2
updates:
  # Keep bundler dependencies up to date
  - package-ecosystem: "bundler"
    directory: "/"
    schedule:
      interval: "weekly"
    # Create a group of dependencies to be updated together in one pull request
    groups:
       # Specify a name for the group, which will be used in pull request titles
       # and branch names
       dev-dependencies:
          # Define patterns to include dependencies in the group (based on
          # dependency name)
          patterns:
            - "rubocop" # A single dependency name
            - "rspec*"  # A wildcard string that matches multiple dependency names
            - "*"       # A wildcard that matches all dependencies in the package
                        # ecosystem. Note: using "*" may open a large pull request
          # Define patterns to exclude dependencies from the group (based on
          # dependency name)
          exclude-patterns:
            - "gc_ruboconfig"
            - "gocardless-*"

Example 3: Group by `update-type````sql

groups: angular: patterns: - “@angular*” update-types: - “minor” - “patch” ignore:

  • dependency-name: “@angular*” update-types: [“version-update:semver-major”]
## Who can use this feature

People with permissions for a repository can configure Dependabot groups for that repository.

### Learn more about grouped updates

- [Configure dependabot.yml](https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#groups)
- [Learn YAML in five minutes](https://www.codeproject.com/Articles/1214409/Learn-YAML-in-five-minutes)
- [Configure Dependabot version updates](https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates#enabling-dependabot-version-updates)

## Written by

 ![Eric Tooley](https://avatars.githubusercontent.com/u/107950541?v=4&s=200)

## Related posts

## Explore more from GitHub

![Docs](https://github.blog/wp-content/uploads/2024/07/Icon-Circle.svg)

### Docs

Everything you need to master GitHub, all in one place.

[Go to Docs](https://docs.github.com/)

![GitHub Universe 2023](https://github.blog/wp-content/uploads/2023/08/Icon-Circle.svg)

### GitHub Universe 2023

Get free virtual tickets to the global developer event for AI, security, and DevEx.

[Get free tickets](https://githubuniverse.com/)

![GitHub Advanced Security](https://github.blog/wp-content/uploads/2022/05/advanced-security.svg)

### GitHub Advanced Security

Secure your code without disrupting innovation.

[Learn more](https://resources.github.com/contact/security/?utm_source=github&utm_medium=site&utm_campaign=2022q2-resources-site-ww-Security-Contact-Request&utm_content=Blog)

![Work at GitHub!](https://github.blog/wp-content/uploads/2022/05/careers.svg)

### Work at GitHub!

Check out our current job openings.

[Apply now](https://www.github.careers/careers-home)