mirror of
https://github.com/jdx/mise-action.git
synced 2026-05-14 13:50:33 +00:00
add all MISE_ env vars to cache key (#197)
Co-authored-by: jdx <216188+jdx@users.noreply.github.com>
This commit is contained in:
parent
883a83c54f
commit
a5b33d7b88
3 changed files with 17 additions and 7 deletions
9
dist/index.js
generated
vendored
9
dist/index.js
generated
vendored
|
|
@ -66588,7 +66588,10 @@ async function restoreMiseCache() {
|
|||
core.startGroup('Restoring mise cache');
|
||||
const version = core.getInput('version');
|
||||
const installArgs = core.getInput('install_args');
|
||||
const { MISE_ENV } = process.env;
|
||||
// all env vars that start with MISE_ are used in the cache key
|
||||
// this allows users to set MISE_ENV or other variables that affect the cache
|
||||
// without having to modify the cache key prefix
|
||||
const env_key = JSON.stringify(Object.fromEntries(Object.entries(process.env).filter(([key]) => key.startsWith('MISE_'))));
|
||||
const cachePath = miseDir();
|
||||
const fileHash = await glob.hashFiles([
|
||||
`**/.config/mise/config.toml`,
|
||||
|
|
@ -66622,8 +66625,8 @@ async function restoreMiseCache() {
|
|||
if (version) {
|
||||
primaryKey = `${primaryKey}-${version}`;
|
||||
}
|
||||
if (MISE_ENV) {
|
||||
primaryKey = `${primaryKey}-${MISE_ENV}`;
|
||||
if (env_key) {
|
||||
primaryKey = `${primaryKey}-${env_key}`;
|
||||
}
|
||||
if (installArgs) {
|
||||
const tools = installArgs
|
||||
|
|
|
|||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
13
src/index.ts
13
src/index.ts
|
|
@ -65,7 +65,14 @@ async function restoreMiseCache(): Promise<string | undefined> {
|
|||
core.startGroup('Restoring mise cache')
|
||||
const version = core.getInput('version')
|
||||
const installArgs = core.getInput('install_args')
|
||||
const { MISE_ENV } = process.env
|
||||
// all env vars that start with MISE_ are used in the cache key
|
||||
// this allows users to set MISE_ENV or other variables that affect the cache
|
||||
// without having to modify the cache key prefix
|
||||
const env_key = JSON.stringify(
|
||||
Object.fromEntries(
|
||||
Object.entries(process.env).filter(([key]) => key.startsWith('MISE_'))
|
||||
)
|
||||
)
|
||||
const cachePath = miseDir()
|
||||
const fileHash = await glob.hashFiles(
|
||||
[
|
||||
|
|
@ -101,8 +108,8 @@ async function restoreMiseCache(): Promise<string | undefined> {
|
|||
if (version) {
|
||||
primaryKey = `${primaryKey}-${version}`
|
||||
}
|
||||
if (MISE_ENV) {
|
||||
primaryKey = `${primaryKey}-${MISE_ENV}`
|
||||
if (env_key) {
|
||||
primaryKey = `${primaryKey}-${env_key}`
|
||||
}
|
||||
if (installArgs) {
|
||||
const tools = installArgs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue