dependabotgithub-dependabot

Dependabot major updates apart from minor and patch updates


I'm trying to get Dependabot to give me different PRs for major versions and minor/patch versions. Here's the config I tried:

version: 2
updates:
  # GH Actions
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "weekly"
    allow:
      - dependency-type: "all"
        update-type: "version-update:semver-minor"
      - dependency-type: "all"
        update-type: "version-update:semver-patch"
    groups:
      gh-actions-minor-patch:
        patterns:
          - "*"

  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "weekly"
    allow:
      - dependency-type: "all"
        update-type: "version-update:semver-major"

  # Composer
  - package-ecosystem: "composer"
    directory: "/"
    schedule:
      interval: "weekly"
    allow:
      - dependency-type: "all"
        update-type: "version-update:semver-minor"
      - dependency-type: "all"
        update-type: "version-update:semver-patch"
    groups:
      composer-minor-patch:
        patterns:
          - "*"

  - package-ecosystem: "composer"
    directory: "/"
    schedule:
      interval: "weekly"
    allow:
      - dependency-type: "all"
        update-type: "version-update:semver-major"

  # NPM
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "weekly"
    allow:
      - dependency-type: "all"
        update-type: "version-update:semver-minor"
      - dependency-type: "all"
        update-type: "version-update:semver-patch"
    groups:
      npm-minor-patch:
        patterns:
          - "*"

  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "weekly"
    allow:
      - dependency-type: "all"
        update-type: "version-update:semver-major"

However, I get the following errors:

Update configs must have a unique combination of 'package-ecosystem', 'directory', and 'target-branch'. Ecosystem 'github-actions' has overlapping directories.
Update configs must have a unique combination of 'package-ecosystem', 'directory', and 'target-branch'. Ecosystem 'composer' has overlapping directories.
Update configs must have a unique combination of 'package-ecosystem', 'directory', and 'target-branch'. Ecosystem 'npm' has overlapping directories.

Is there any way to actually do this?


Solution

  • You can't repeat the package ecosystem, as the error tells you, but you don't need to make them separate updates items. For example, to have:

    you can adapt this example from the documentation:

    version: 2
    updates:
    
      # NPM
      - package-ecosystem: "npm"
        directory: "/"
        schedule:
          interval: "weekly"
        groups:
          npm-minor-patch:
            patterns:
              - "*"
            update-types:
              - "minor"
              - "patch"
    

    This works because, per the config reference:

    When groups is used to define rules:

    • All updates for dependencies that match a rule are combined in a single pull request.
    • ...
    • Any outdated dependencies that do not match a rule are updated in individual pull requests.

    Here all minor or patch updates match the npm-minor-patch rule, so they're grouped into one PR, and all major updates don't match any rule, so they're individual.