Files
renovate/lib/modules/manager/github-actions/known-actions/dotnet-version.ts
Jamie Tanna fe649335ce fix(manager/github-actions): treat dotnet-version as a range
While looking at the fix for `actions/setup-java`, we noticed that
`actions/setup-dotnet` may also be affected, as it notes:

> - **A.B** or **A.B.x** installs the latest patch version of .NET SDK
>   on the channel
> - **A** or **A.x** installs the latest minor version of the specified
>   major tag

alongside `A.B.Cxx` for "the latest version of the specific SDK release"
and `latest` for "the highest active .NET SDK version".

As these fall back to `semver-coerced`, which happily coerces `8.0.x` to
`8.0.0`, Renovate then raises a PR to bump to a full version such as
`9.0.100`, which isn't the intent.

Rather than the `semver-partial` versioning used for the other Actions,
here we can use `npm` versioning, which understands the x-range form
too, and safely rejects `8.0.4xx`/`latest` as values we have no version
to bump them to.

Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io>
2026-09-16 14:14:43 +01:00

18 lines
775 B
TypeScript

import { DotnetVersionDatasource } from '../../../datasource/dotnet-version/index.ts';
import * as npmVersioning from '../../../versioning/npm/index.ts';
import type { KnownActionConfig } from '../types.ts';
import { valSchema } from './utils.ts';
export const dotnetVersionActions: Record<string, KnownActionConfig> = {
// https://github.com/actions/setup-dotnet
'actions/setup-dotnet': {
datasource: DotnetVersionDatasource.id,
packageName: 'dotnet-sdk',
// `dotnet-version` may be a channel (`8.0`), an x-range (`8.0.x`, `8.x`)
// or a major (`8`) rather than a pinned version, so it needs a versioning
// which understands ranges
versioning: npmVersioning.id,
withSchema: valSchema('dotnet-version', (val) => val.includes('\n')),
},
};