Skip to content

Commit f60ef1e

Browse files
committed
Include working directory, $BUNDLE_WITH and $BUNDLE_WITHOUT in cache key
* Fixes #350 * Fixes #176
1 parent bc4e585 commit f60ef1e

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

bundler.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,14 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
232232
}
233233

234234
async function computeBaseKey(platform, engine, version, lockFile, cacheVersion) {
235-
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
236-
let key = `setup-ruby-bundler-cache-v4-${platform}-${engine}-${version}${cacheVersionSuffix}`
235+
const cwd = process.cwd()
236+
const bundleWith = process.env['BUNDLE_WITH'] || ''
237+
const bundleWithout = process.env['BUNDLE_WITHOUT'] || ''
238+
let key = `setup-ruby-bundler-cache-v5-${platform}-${engine}-${version}-wd-${cwd}-with-${bundleWith}-without-${bundleWithout}`
239+
240+
if (cacheVersion !== DEFAULT_CACHE_VERSION) {
241+
key += `-v-${cacheVersion}`
242+
}
237243

238244
if (common.isHeadVersion(version)) {
239245
if (engine !== 'jruby') {

dist/index.js

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)