Skip to main content

Add cooldown periods to Dependabot configuration

org.openrewrite.github.AddDependabotCooldown

Adds a cooldown section to each update configuration in Dependabot files. Supports default-days, semver-major-days, semver-minor-days, semver-patch-days, include, and exclude options. This implements a security best practice where dependencies are not immediately adopted upon release, allowing time for security vendors to identify potential supply chain compromises. Cooldown applies only to version updates, not security updates. Read more about dependency cooldowns. The available configuration options for dependabot are listed on GitHub.

Tags

Recipe source

GitHub, Issue Tracker, Maven Central

This recipe is available under the Moderne Source Available License.

Options

TypeNameDescriptionExample
IntegercooldownDaysOptional. The number of days to wait before considering a published dependency suitable for use (1-90). This delay allows security vendors time to identify potential compromises. Applied to all version types unless specific semver options are set.7
IntegersemverMajorDaysOptional. The number of days to wait for major version updates (1-90). Only applies to package managers that support semantic versioning.14
IntegersemverMinorDaysOptional. The number of days to wait for minor version updates (1-90). Only applies to package managers that support semantic versioning.7
IntegersemverPatchDaysOptional. The number of days to wait for patch version updates (1-90). Only applies to package managers that support semantic versioning.3
ListincludeOptional. List of up to 150 dependencies to apply cooldown to. Supports wildcard patterns with *. If not specified, cooldown applies to all dependencies.lodash, react*
ListexcludeOptional. List of up to 150 dependencies to exempt from cooldown. Supports wildcard patterns with *. Exclude list takes precedence over include list.critical-security-package

Example

Parameters
ParameterValue
cooldownDaysnull
semverMajorDaysnull
semverMinorDaysnull
semverPatchDaysnull
includenull
excludenull
Before
.github/dependabot.yml
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
- package-ecosystem: maven
directory: /
schedule:
interval: weekly
After
.github/dependabot.yml
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
cooldown:
default-days: 7
- package-ecosystem: maven
directory: /
schedule:
interval: weekly
cooldown:
default-days: 7

Usage

This recipe has no required configuration options. It can be activated by adding a dependency on org.openrewrite.recipe:rewrite-github-actions in your build file or by running a shell command (in which case no build changes are needed):

  1. Add the following to your build.gradle file:
build.gradle
plugins {
id("org.openrewrite.rewrite") version("latest.release")
}

rewrite {
activeRecipe("org.openrewrite.github.AddDependabotCooldown")
setExportDatatables(true)
}

repositories {
mavenCentral()
}

dependencies {
rewrite("org.openrewrite.recipe:rewrite-github-actions:3.16.0")
}
  1. Run gradle rewriteRun to run the recipe.

See how this recipe works across multiple open-source repositories

Run this recipe on OSS repos at scale with the Moderne SaaS.

The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.

Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.

Data Tables

Source files that had results

org.openrewrite.table.SourcesFileResults

Source files that were modified by the recipe run.

Column NameDescription
Source path before the runThe source path of the file before the run. null when a source file was created during the run.
Source path after the runA recipe may modify the source path. This is the path after the run. null when a source file was deleted during the run.
Parent of the recipe that made changesIn a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all.
Recipe that made changesThe specific recipe that made a change.
Estimated time savingAn estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds.
CycleThe recipe cycle in which the change was made.