mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-25 23:11:31 +00:00
fix(manager/github-actions): don't pin partial ruby-versions
While looking at the fix for `actions/setup-java`, we noticed that the `ruby/setup-ruby` may also be affected, as it notes: > short version like '2.6', automatically using the latest release > matching that version As Ruby versioning treats `3.4` as a pinned version rather than a range, we'd propose a patch upgrade rewriting it to `3.4.7`, losing the rolling behaviour the workflow asked for. We can reuse the `semver-partial` handling as a `partialValSchema` helper, so short versions keep their precision and only exact versions are looked up as pinned. Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io>
This commit is contained in:
@@ -2525,6 +2525,8 @@ describe('modules/manager/github-actions/extract', () => {
|
||||
],
|
||||
},
|
||||
{
|
||||
// a short `ruby-version` is the latest release matching it, so it must
|
||||
// keep its precision rather than gain a patch component
|
||||
step: {
|
||||
uses: 'ruby/setup-ruby@v1',
|
||||
with: { 'ruby-version': '3.4' },
|
||||
@@ -2536,6 +2538,22 @@ describe('modules/manager/github-actions/extract', () => {
|
||||
depName: 'ruby',
|
||||
depType: 'uses-with',
|
||||
packageName: 'ruby',
|
||||
versioning: 'semver-partial',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
step: {
|
||||
uses: 'ruby/setup-ruby@v1',
|
||||
with: { 'ruby-version': '3.4.7' },
|
||||
},
|
||||
expected: [
|
||||
{
|
||||
currentValue: '3.4.7',
|
||||
datasource: 'ruby-version',
|
||||
depName: 'ruby',
|
||||
depType: 'uses-with',
|
||||
packageName: 'ruby',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { RubyVersionDatasource } from '../../../datasource/ruby-version/index.ts';
|
||||
import type { KnownActionConfig } from '../types.ts';
|
||||
import { valSchema } from './utils.ts';
|
||||
import { partialValSchema } from './utils.ts';
|
||||
|
||||
export const rubyVersionActions: Record<string, KnownActionConfig> = {
|
||||
// https://github.com/ruby/setup-ruby
|
||||
'ruby/setup-ruby': {
|
||||
datasource: RubyVersionDatasource.id,
|
||||
packageName: 'ruby',
|
||||
withSchema: valSchema('ruby-version'),
|
||||
// a short `ruby-version` such as `3.3` means the latest release matching
|
||||
// it, rather than a pinned version
|
||||
withSchema: partialValSchema('ruby-version'),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -94,6 +94,18 @@ export function valSchema(
|
||||
.transform((val) => [parseValue(val[key], isInvalid)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* As `valSchema`, for inputs which accept a partial version.
|
||||
*/
|
||||
export function partialValSchema(
|
||||
key: string,
|
||||
isInvalid?: (val: string) => boolean,
|
||||
): ActionSchema {
|
||||
return z
|
||||
.object({ [key]: z.string().optional() })
|
||||
.transform((val) => [parsePartialValue(val[key], isInvalid)]);
|
||||
}
|
||||
|
||||
export const VersionVal = valSchema('version');
|
||||
|
||||
export function parseImageValue(image: string | undefined): PackageDependency {
|
||||
|
||||
Reference in New Issue
Block a user