Skip to main content

Configuring Dependabot version updates

You can configure your repository so that Dependabot automatically updates the packages you use.

¿Quién puede utilizar esta característica?

Users with write access

About version updates for dependencies

You enable Dependabot version updates by checking a dependabot.yml configuration file in to your repository's .github directory. Dependabot then raises pull requests to keep the dependencies you configure up-to-date. For each package manager's dependencies that you want to update, you must specify the location of the package manifest files and how often to check for updates to the dependencies listed in those files. For information about enabling security updates, see Configuring Dependabot security updates.

Cuando habilitas las actualizaciones de versión por primera vez, podrías tener muchas dependencias desactualizadas y algunas podrían estar varias versiones debajo de la última. Dependabot verifica las dependencias que estén desactualizadas tan pronto se habilita. Podrías ver nuevas solicitudes de extracción para las actualizaciones de versión después de algunos minutos de haber agregado el archivo de configuración, dependiendo de la cantidad de archivos de manifiesto para los cuales configuras las actualizaciones. El Dependabot también ejecutará una actualización en los cambios subsecuentes al archivo de configuración.

Para facilitar la administración y revisión de las solicitudes de incorporación de cambios, Dependabot genera un máximo de cinco solicitudes de incorporación de cambios para comenzar a actualizar a las dependencias a su versión más reciente. Si fusionas algunas de estas primeras solicitudes de cambios en la siguiente actualización programada, aquellas restantes se abrirán en la siguiente actualización, hasta ese máximo. Puede cambiar el número máximo de solicitudes de incorporación de cambios abiertas si establece la opción de configuración open-pull-requests-limit.

Para reducir aún más el número de solicitudes de cambios que puedes ver, puedes usar la opción de configuración groups para agrupar conjuntos de dependencias (por ecosistema de paquetes). Después, Dependabot genera una única solicitud de cambios para actualizar tantas dependencias como sea posible en el grupo a las versiones más recientes al mismo tiempo. For more information, see Optimización de la creación de solicitudes de cambios para actualizaciones de versión de Dependabot.

A veces, debido a una configuración incorrecta o a una versión incompatible, es posible que veas un error en la ejecución de Dependabot. Al cabo de 15 errores de ejecución, Dependabot version updates omitirá las ejecuciones programadas posteriores hasta que desencadenes manualmente una comprobación de actualizaciones desde el gráfico de dependencia. Las Dependabot security updates se seguirán ejecutando de la forma habitual.

By default only direct dependencies that are explicitly defined in a manifest are kept up to date by Dependabot version updates. You can choose to receive updates for indirect dependencies defined in lock files. For more information, see Controlling which dependencies are updated by Dependabot.

Cuando ejecutas actualizaciones de versión o de seguridad, algunos ecosistemas deberán poder resolver todas las dependencias de su fuente para verificar que las actualizaciones sean exitosas. Si tus archivos de manifiesto o de bloqueo contienen cualquier dependencia privada, el Dependabot deberá poder acceder a la ubicación en la que se hospedan dichas dependencias. Los propietarios de las organizaciones pueden otorgar acceso al Dependabot para los repositorios privados que contengan dependencias para un proyecto dentro de la misma organización. Para más información, consulta Administrar la configuración de seguridad y análisis de su organización. Puede configurar el acceso a los registros privados en el archivo de configuración dependabot.yml de un repositorio. Para más información, consulta Configuring access to private registries for Dependabot. Additionally, Dependabot doesn't support private GitHub dependencies for all package managers. For more information, see Ecosistemas y repositorios admitidos por Dependabot and Compatibilidad de lenguajes de GitHub.

Enabling Dependabot version updates

You enable Dependabot version updates by committing a dependabot.yml configuration file to your repository. If you enable the feature in your settings page, GitHub creates a basic file which you can edit, otherwise you can create the file using any file editor.

  1. En GitHub, navegue hasta la página principal del repositorio.

  2. Debajo del nombre del repositorio, haz clic en Settings. Si no puedes ver la pestaña "Configuración", selecciona el menú desplegable y, a continuación, haz clic en Configuración.

    Captura de pantalla de un encabezado de repositorio en el que se muestran las pestañas. La pestaña "Configuración" está resaltada con un contorno naranja oscuro.

  3. En la sección "Security" de la barra lateral, haz clic en Advanced Security.

  4. Under "Dependabot", to the right of "Dependabot version updates", click Enable to open a basic dependabot.yml configuration file in the .github directory of your repository. For information about the options you can use to customize how Dependabot maintains your repositories, see Referencia de opciones de Dependabot.

    YAML
    # To get started with Dependabot version updates, you'll need to specify which
    # package ecosystems to update and where the package manifests are located.
    
    version: 2
    updates:
    - package-ecosystem: "" # See documentation for possible values
      directory: "/" # Location of package manifests
      schedule:
        interval: "weekly"
    
  5. Add a version. This key is mandatory. The file must start with version: 2.

  6. Optionally, if you have dependencies in a private registry, add a registries section containing authentication details. For more information, see Configuring access to private registries for Dependabot.

  7. Add an updates section, with an entry for each package manager you want Dependabot to monitor. This key is mandatory. You use it to configure how Dependabot updates the versions or your project's dependencies. Each entry configures the update settings for a particular package manager. For more information, see About the dependabot.yml file in "Dependabot options reference."

  8. For each package manager, use:

    • package-ecosystem to specify the package manager. For more information about the supported package managers, see package-ecosystem.
    • directories or directory to specify the location of multiple manifest or other definition files. For more information, see Defining multiple locations for manifest files.
    • schedule.interval to specify how often to check for new versions.
  9. Compruebe el archivo de configuración dependabot.yml en el directorio .github del repositorio.

Example dependabot.yml file

The example dependabot.yml file below configures version updates for three package managers: npm, Docker, and GitHub Actions. When this file is checked in, Dependabot checks the manifest files on the default branch for outdated dependencies. If it finds outdated dependencies, it will raise pull requests against the default branch to update the dependencies.

YAML
# Basic `dependabot.yml` file with
# minimum configuration for three package managers

version: 2
updates:
  # Enable version updates for npm
  - package-ecosystem: "npm"
    # Look for `package.json` and `lock` files in the `root` directory
    directory: "/"
    # Check the npm registry for updates every day (weekdays)
    schedule:
      interval: "daily"

  # Enable version updates for Docker
  - package-ecosystem: "docker"
    # Look for a `Dockerfile` in the `root` directory
    directory: "/"
    # Check for updates once a week
    schedule:
      interval: "weekly"

  # Enable version updates for GitHub Actions
  - package-ecosystem: "github-actions"
    # Workflow files stored in the default location of `.github/workflows`
    # You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.
    directory: "/"
    schedule:
      interval: "weekly"

In the example above, if the Docker dependencies were very outdated, you might want to start with a daily schedule until the dependencies are up-to-date, and then drop back to a weekly schedule.

Enabling version updates on forks

If you want to enable version updates on forks, there's an extra step. Version updates are not automatically enabled on forks when a dependabot.yml configuration file is present. This ensures that fork owners don't unintentionally enable version updates when they pull changes including a dependabot.yml configuration file from the original repository.

On a fork, you also need to explicitly enable Dependabot.

  1. En GitHub, navegue hasta la página principal del repositorio.

  2. Debajo del nombre del repositorio, haz clic en Settings. Si no puedes ver la pestaña "Configuración", selecciona el menú desplegable y, a continuación, haz clic en Configuración.

    Captura de pantalla de un encabezado de repositorio en el que se muestran las pestañas. La pestaña "Configuración" está resaltada con un contorno naranja oscuro.

  3. En la sección "Security" de la barra lateral, haz clic en Advanced Security.

  4. Under "Dependabot," to the right of "Dependabot version updates," click Enable to allow Dependabot to initiate version updates.

Checking the status of version updates

After you enable version updates, the Dependabot tab in the dependency graph for the repository is populated. This tab shows which package managers Dependabot is configured to monitor and when Dependabot last checked for new versions.

Screenshot of the Dependency graph page. A tab, titled "Dependabot," is highlighted with an orange outline.

For information, see Listing dependencies configured for version updates.

Disabling Dependabot version updates

You can disable version updates entirely by deleting the dependabot.yml file from your repository. More usually, you want to disable updates temporarily for one or more dependencies, or package managers.

  • Package managers: disable by setting open-pull-requests-limit: 0 or by commenting out the relevant package-ecosystem in the configuration file.
  • Specific dependencies: disable by adding ignore attributes for packages or applications that you want to exclude from updates.

When you disable dependencies, you can use wild cards to match a set of related libraries. You can also specify which versions to exclude. This is particularly useful if you need to block updates to a library, pending work to support a breaking change to its API, but want to get any security fixes to the version you use.

Example disabling version updates for some dependencies

The example dependabot.yml file below includes examples of the different ways to disable updates to some dependencies, while allowing other updates to continue.

# `dependabot.yml` file with updates
# disabled for Docker and limited for npm

version: 2
updates:
  # Configuration for Dockerfile
  - package-ecosystem: "docker"
    directory: "/"
    schedule:
      interval: "weekly"
      # Disable all pull requests for Docker dependencies
    open-pull-requests-limit: 0

  # Configuration for npm
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "weekly"
    ignore:
      # Ignore updates to packages that start with 'aws'
      # Wildcards match zero or more arbitrary characters
      - dependency-name: "aws*"
      # Ignore some updates to the 'express' package
      - dependency-name: "express"
        # Ignore only new versions for 4.x and 5.x
        versions: ["4.x", "5.x"]
      # For all packages, ignore all patch updates
      - dependency-name: "*"
        update-types: ["version-update:semver-patch"]

For more information about checking for existing ignore preferences, see Referencia de opciones de Dependabot.