From 87be784f5e8bb0aed9d4d58ed563be2d71c9ed66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Wed, 21 Oct 2026 12:00:09 -0700 Subject: [PATCH] Avoid reinstalling bundler if the required version is already installed --- bundler.js | 5 +++-- dist/index.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bundler.js b/bundler.js index 59f969e94..a25d0e5ec 100644 --- a/bundler.js +++ b/bundler.js @@ -142,9 +142,10 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock const gem = path.join(rubyPrefix, 'bin', 'gem') const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length - const bundlerVersionConstraint = versionParts >= 3 ? bundlerVersion : `~> ${bundlerVersion}.0` + // Use --conservative to avoid reinstalling the exact same version if already installed. + const options = versionParts >= 3 ? ['-v', bundlerVersion, '--conservative'] : ['-v', `~> ${bundlerVersion}.0`] - await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint]) + await exec.exec(gem, ['install', 'bundler', ...options]) return bundlerVersion } diff --git a/dist/index.js b/dist/index.js index bb1e278d5..d18a5cf54 100644 --- a/dist/index.js +++ b/dist/index.js @@ -156,9 +156,10 @@ async function installBundler(bundlerVersionInput, rubygemsInputSet, lockFile, p const gem = path.join(rubyPrefix, 'bin', 'gem') const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length - const bundlerVersionConstraint = versionParts >= 3 ? bundlerVersion : `~> ${bundlerVersion}.0` + // Use --conservative to avoid reinstalling the exact same version if already installed. + const options = versionParts >= 3 ? ['-v', bundlerVersion, '--conservative'] : ['-v', `~> ${bundlerVersion}.0`] - await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint]) + await exec.exec(gem, ['install', 'bundler', ...options]) return bundlerVersion }