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`
This commit is contained in:
Tobias Bieniek
2026-06-13 10:04:51 +02:00
committed by GitHub
parent e9ee107b1a
commit a73e4d1adc
3 changed files with 70 additions and 0 deletions
@@ -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<string, CommunityActionConfig> = {
packageName: 'moby/moby',
extractVersion: '^docker-(?<version>.+)$',
},
// 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',
@@ -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] } } });
@@ -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,
];