mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Use BUNDLE_LOCKFILE when detecting the lockfile
Honor `BUNDLE_LOCKFILE` (added in Bundler 4) when selecting the lockfile used for Bundler version detection, deployment mode, and bundler-cache keys. Without this, workflows using an alternate lockfile can read the wrong `BUNDLED WITH` version and generate cache keys from the wrong lockfile.
This commit is contained in:
committed by
Benoit Daloze
parent
a99ac84464
commit
12fd324f1d
+4
-2
@@ -15,14 +15,16 @@ function isValidBundlerVersion(bundlerVersion) {
|
||||
// The returned gemfile is guaranteed to exist, the lockfile might not exist
|
||||
export function detectGemfiles() {
|
||||
const gemfilePath = process.env['BUNDLE_GEMFILE'] || 'Gemfile'
|
||||
const lockfilePath = process.env['BUNDLE_LOCKFILE']
|
||||
|
||||
if (fs.existsSync(gemfilePath)) {
|
||||
return [gemfilePath, `${gemfilePath}.lock`]
|
||||
return [gemfilePath, lockfilePath || `${gemfilePath}.lock`]
|
||||
} else if (process.env['BUNDLE_GEMFILE']) {
|
||||
throw new Error(`$BUNDLE_GEMFILE is set to ${gemfilePath} but does not exist`)
|
||||
}
|
||||
|
||||
if (fs.existsSync("gems.rb")) {
|
||||
return ["gems.rb", "gems.locked"]
|
||||
return ["gems.rb", lockfilePath || "gems.locked"]
|
||||
}
|
||||
|
||||
return [null, null]
|
||||
|
||||
Reference in New Issue
Block a user