From a73e4d1adc55ec802d63dbd34ea149dfd382e918 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Sat, 13 Jun 2026 10:04:51 +0200 Subject: [PATCH] feat(manager/github-actions): support dtolnay/rust-toolchain `toolchain` input (#43956) * feat(manager/github-actions): support dtolnay/rust-toolchain `toolchain` input Extract the `toolchain` input of `dtolnay/rust-toolchain` as a `rust` dependency via the `rust-version` datasource, mirroring the rust-toolchain manager. Sliding-window expressions like `stable 18 months ago` are extracted as-is and rejected by the `rust-release-channel` versioning during lookup. * feat(manager/github-actions): add rust-version datasource to `supportedDatasources` --- .../manager/github-actions/community.ts | 7 +++ .../manager/github-actions/extract.spec.ts | 61 +++++++++++++++++++ lib/modules/manager/github-actions/index.ts | 2 + 3 files changed, 70 insertions(+) diff --git a/lib/modules/manager/github-actions/community.ts b/lib/modules/manager/github-actions/community.ts index 49cbca090a..a2487daf41 100644 --- a/lib/modules/manager/github-actions/community.ts +++ b/lib/modules/manager/github-actions/community.ts @@ -6,6 +6,7 @@ import { GithubReleasesDatasource } from '../../datasource/github-releases/index import { NpmDatasource } from '../../datasource/npm/index.ts'; import { PypiDatasource } from '../../datasource/pypi/index.ts'; import { RubyVersionDatasource } from '../../datasource/ruby-version/index.ts'; +import { RustVersionDatasource } from '../../datasource/rust-version/index.ts'; import * as condaVersioning from '../../versioning/conda/index.ts'; import * as npmVersioning from '../../versioning/npm/index.ts'; import type { PackageDependency } from '../types.ts'; @@ -140,6 +141,12 @@ export const communityActions: Record = { packageName: 'moby/moby', extractVersion: '^docker-(?.+)$', }, + // https://github.com/dtolnay/rust-toolchain + 'dtolnay/rust-toolchain': { + datasource: RustVersionDatasource.id, + packageName: 'rust', + withSchema: valSchema('toolchain'), + }, 'golangci/golangci-lint-action': { datasource: GithubReleasesDatasource.id, packageName: 'golangci/golangci-lint', diff --git a/lib/modules/manager/github-actions/extract.spec.ts b/lib/modules/manager/github-actions/extract.spec.ts index 470fb9db41..9315c0d9a5 100644 --- a/lib/modules/manager/github-actions/extract.spec.ts +++ b/lib/modules/manager/github-actions/extract.spec.ts @@ -1685,6 +1685,67 @@ describe('modules/manager/github-actions/extract', () => { }, ], }, + { + step: { + uses: 'dtolnay/rust-toolchain@master', + with: { toolchain: '1.89.0' }, + }, + expected: [ + { + currentValue: '1.89.0', + datasource: 'rust-version', + depName: 'rust', + depType: 'uses-with', + packageName: 'rust', + }, + ], + }, + { + step: { + uses: 'dtolnay/rust-toolchain@master', + with: { toolchain: 'nightly-2025-01-01' }, + }, + expected: [ + { + currentValue: 'nightly-2025-01-01', + datasource: 'rust-version', + depName: 'rust', + depType: 'uses-with', + packageName: 'rust', + }, + ], + }, + { + step: { + uses: 'dtolnay/rust-toolchain@stable', + with: { toolchain: 'stable' }, + }, + expected: [ + { + currentValue: 'stable', + datasource: 'rust-version', + depName: 'rust', + depType: 'uses-with', + packageName: 'rust', + }, + ], + }, + { + step: { + uses: 'dtolnay/rust-toolchain@master', + with: {}, + }, + expected: [ + { + datasource: 'rust-version', + depName: 'rust', + depType: 'uses-with', + packageName: 'rust', + skipStage: 'extract', + skipReason: 'unspecified-version', + }, + ], + }, ])('extract from $step.uses', ({ step, expected }) => { const yamlContent = yaml.dump({ jobs: { build: { steps: [step] } } }); diff --git a/lib/modules/manager/github-actions/index.ts b/lib/modules/manager/github-actions/index.ts index 39b57f1af7..1313adc951 100644 --- a/lib/modules/manager/github-actions/index.ts +++ b/lib/modules/manager/github-actions/index.ts @@ -3,6 +3,7 @@ import { GiteaTagsDatasource } from '../../datasource/gitea-tags/index.ts'; import { GithubDigestDatasource } from '../../datasource/github-digest/index.ts'; import { GithubRunnersDatasource } from '../../datasource/github-runners/index.ts'; import { GithubTagsDatasource } from '../../datasource/github-tags/index.ts'; +import { RustVersionDatasource } from '../../datasource/rust-version/index.ts'; export { knownDepTypes } from './dep-types.ts'; export { extractPackageFile } from './extract.ts'; @@ -23,4 +24,5 @@ export const supportedDatasources = [ GithubDigestDatasource.id, GithubRunnersDatasource.id, GithubTagsDatasource.id, + RustVersionDatasource.id, ];