diff --git a/lib/modules/manager/bundler/artifacts.spec.ts b/lib/modules/manager/bundler/artifacts.spec.ts index 66cb6af9da5584..3167439bc870d5 100644 --- a/lib/modules/manager/bundler/artifacts.spec.ts +++ b/lib/modules/manager/bundler/artifacts.spec.ts @@ -946,6 +946,27 @@ describe('modules/manager/bundler/artifacts', () => { { cmd: 'bundler lock --minor --conservative --update foo' }, ]); }); + + it('updates the Gemfile.lock when ruby upgraded', async () => { + // See https://github.com/renovatebot/renovate/issues/15114 + fs.readLocalFile.mockResolvedValue('Current Gemfile.lock'); + const execSnapshots = mockExecSequence([{ stdout: '', stderr: '' }]); + git.getRepoStatus.mockResolvedValueOnce( + partial({ + modified: ['Gemfile.lock'], + }), + ); + + const res = await updateArtifacts({ + packageFileName: 'Gemfile', + updatedDeps: [{ depName: 'ruby', updateType: 'patch' }], + newPackageFileContent: '{}', + config, + }); + + expect(res).toMatchObject([{ file: { path: 'Gemfile.lock' } }]); + expect(execSnapshots).toMatchObject([{ cmd: 'bundler lock' }]); + }); }); }); }); diff --git a/lib/modules/manager/bundler/artifacts.ts b/lib/modules/manager/bundler/artifacts.ts index 60e17f6f4fea8e..87208070959938 100644 --- a/lib/modules/manager/bundler/artifacts.ts +++ b/lib/modules/manager/bundler/artifacts.ts @@ -121,6 +121,13 @@ export async function updateArtifacts( commands.push(cmd); } } + + const rubyUpgraded = updatedDeps + .map((dep) => dep.depName) + .includes('ruby'); + if (rubyUpgraded) { + commands.push('bundler lock'); + } } const bundlerHostRules = findAllAuthenticatable({