Repository navigation
Description
What
Let Dependabot open pull requests when a new version is out of:
- a GitHub Action of
.github/workflows; - a library or Gradle plugin of the build, as those of
gradle/libs.versions.toml; - the Gradle wrapper.
Today nothing tells us, and the versions are upgraded by hand.
What we have today
- No
.github/dependabot.yml, and no pull request has ever come from Dependabot. - Dependabot alerts are on. There have been 6, all for
gradle/gradle-build-action(GHSA-h3qr-39j9-4r5v), opened in 2023-11 and fixed in 2024-03. None is open. - The alerts only see the GitHub Actions. The dependency graph of the repository has 10 actions and no Gradle dependency, so a vulnerable LSP4J, flexmark or Gradle plugin would raise no alert. GitHub doesn't read a Gradle build by itself: the build has to submit its dependencies.
- Two of the libraries are out of Dependabot's sight:
build.gradle.ktsreads the versions of LSP4J and flexmark fromgradle.properties, withprop("lsp4jVersion")andprop("flexmarkVersion");- Dependabot reads the build files without running them, and its docs don't say that it resolves a value read through a function like that;
- those two are the libraries that the plugin bundles, so they matter most for security.
- The wrapper's version is held in two places: in
gradle-wrapper.properties, and asgradleVersioningradle.properties, which thewrappertask ofbuild.gradle.ktsreads. A wrapper update by Dependabot changes only the first. The next./gradlew wrapperwould then go back to the old version.
What it takes
1. A pull request, which anyone with write access can merge
Committing .github/dependabot.yml is what turns on version updates (docs). No setting needs an admin.
The pull request would:
a. Move the versions of LSP4J and flexmark into gradle/libs.versions.toml, with their libraries, and use libs.… in build.gradle.kts. Do the same for junit-platform-launcher, which build.gradle.kts sets to 1.11.0 itself. Dependabot supports the version catalog gradle/libs.versions.toml (docs).
b. Drop gradleVersion from gradle.properties and from the wrapper task. Without it, ./gradlew wrapper keeps the version that runs it, which is the one of gradle-wrapper.properties. The task keeps its networkTimeout and its retries. Dependabot updates the wrapper within the gradle ecosystem: gradle-wrapper.properties, gradlew, gradlew.bat and gradle-wrapper.jar.
c. Add .github/dependabot.yml:
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
# "ci(deps): bump …", which the pull request title check accepts, and which the release notes leave out
commit-message:
prefix: "ci"
include: "scope"
labels:
- "build"
groups:
github-actions:
patterns:
- "*"
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"
# "build(deps): bump …", which the release notes list under Build
commit-message:
prefix: "build"
include: "scope"
labels:
- "build"
ignore:
# Kotlin 2.4 no longer accepts apiVersion/languageVersion 1.9, which the plugin needs while pluginSinceBuild is
# 242: see gradle/libs.versions.toml
- dependency-name: "org.jetbrains.kotlin.jvm"
versions: [">= 2.4"]
groups:
# One pull request a week for the minor and patch versions; a major version gets a pull request of its own
gradle-minor-and-patch:
update-types:
- "minor"
- "patch"Notes on it:
- The pull request title check (
amannn/action-semantic-pull-request) needs a Conventional Commits title. Dependabot's own title,Bump x from 1 to 2, would fail it, so the config sets theprefixtociorbuild, with thedepsscope. - The release notes take
buildcommits under "Build" and leave outciones. A grouped update reads "bump the gradle-minor-and-patch group with 3 updates", and the commit body lists the versions. - Labels: without
labels, Dependabot creates and addsdependenciesandjavaorgithub_actions. Withlabels, it adds the repository's ownbuildlabel instead. - Groups keep the pull requests few. Each push to a pull request starts 4 workflows, and CodeRabbit reviews 2 pull requests an hour.
- Actions pinned by commit SHA, as
amannn/action-semantic-pull-request@d2ab… #v3.1.0: Dependabot updates the SHA and the version comment that follows it on the same line. - The name of the Kotlin plugin in
ignore: Dependabot's docs givegroupId:artifactIdfor Gradle dependencies, and don't say how they name a plugin of the version catalog. To check on its first run: if a pull request offers Kotlin 2.4, use the name that it gives. .github/workflows/itests.yml.disabledisn't a.ymlfile, so Dependabot doesn't read it.- CI on its pull requests: a workflow that a Dependabot pull request starts gets a read-only
GITHUB_TOKENand no Actions secrets (docs). The pull request workflows (ci.yml,IJ.yml,buildZip.yml,conventionalCheck.yml) use no secret but theGITHUB_TOKEN, so they run as for any pull request.
2. A second pull request, for alerts on the Gradle dependencies (recommended)
Add a workflow that submits the dependencies of the Gradle build to the dependency graph, with gradle/actions/dependency-submission, on each push to main. Use 6.4.1 or later, pinned by SHA: GHSA-chpw-2mqm-95cc (high) affects dependency-submission up to 6.4.0. In v6, the caching of gradle/actions comes under Gradle's Terms of Use unless cache-provider: basic is set (see #2103). The repository already uses gradle/actions/setup-gradle from the same repository. The job needs permissions: contents: write. After it runs once, Dependabot alerts cover LSP4J, flexmark and the other libraries, as they cover the actions today.
3. Needs an admin of the repository (optional)
Dependabot security updates open a pull request as soon as an alert has a fixed version, without waiting for the weekly run. An admin turns them on in Settings › Advanced Security › Dependabot security updates (docs).
@angelozerr, this is the only step that needs you, as an admin. Steps 1 and 2 are pull requests. Would you like security updates on?
Not covered
- The IntelliJ versions that CI and "Latest IJ" test (
platformVersion) aren't dependencies, so Dependabot doesn't update them. ci: keep the IntelliJ IDEA (IU) release of ci.yml up to date #2062 and ci: test the newest IntelliJ IDEA release in "Latest IJ" while ci.yml tests an older one #2098 cover those. - The versions of the servers that the templates install aren't dependencies of the build either. Installers: keep download versions current #1961 covers those.
- Today's outdated versions, with what upgrading each means, are in build: bring the dependencies, Gradle plugins and GitHub Actions up to date, and harden the workflows #2103, so that they can be upgraded once, with care, before Dependabot takes over.
Activity