FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use case-insensitive key comparison for cache keys by BytewaveMLP · Pull Request #660 · ruby/setup-ruby · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .js  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion bundler.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
await exec.exec('bundle', ['install', '--jobs', '4'])

// @actions/cache only allows to save for non-existing keys
if (cachedKey !== key) {
if (!common.isExactCacheKeyMatch(key, cachedKey)) {
if (cachedKey) { // existing cache but Gemfile.lock differs, clean old gems
await exec.exec('bundle', ['clean'])
}
Expand Down
12 changes: 12 additions & 0 deletions common.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -412,3 +412,15 @@ export async function setupJavaHome(rubyPrefix) {
}
})
}

// Determines if two keys are an exact match for the purposes of cache matching
// Specifically, this is a case-insensitive match that ignores accents
// From actions/cache@v3 src/utils/actionUtils.ts (MIT)
export function isExactCacheKeyMatch(key, cacheKey) {
return !!(
cacheKey &&
cacheKey.localeCompare(key, undefined, {
sensitivity: 'accent'
}) === 0
);
}
15 changes: 14 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

Back | FazBrowse Home | New Git URL