fix(cache): replace , in MISE_ENV with - (#278)

Fixes https://github.com/jdx/mise-action/issues/276

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Replaces commas in MISE_ENV with hyphens when constructing the cache
key to ensure stable/valid keys.
> 
> - **Cache Key Generation**:
> - In `src/index.ts`, normalizes `MISE_ENV` via `replace(/,/g, '-')`
and uses it as `mise_env` when building the cache key template.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
899df938a6. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
This commit is contained in:
Risu 2025-10-02 10:16:12 +10:00 committed by GitHub
parent a09b8e9f78
commit 2f998c07b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 11 deletions

4
dist/index.js generated vendored
View file

@ -50306,7 +50306,7 @@ async function processCacheKeyTemplate(template) {
const version = core.getInput('version');
const installArgs = core.getInput('install_args');
const cacheKeyPrefix = core.getInput('cache_key_prefix') || 'mise-v0';
const { MISE_ENV } = process.env;
const miseEnv = process.env.MISE_ENV?.replace(/,/g, '-');
const platform = await getTarget();
// Calculate file hash
const fileHash = await glob.hashFiles(MISE_CONFIG_FILE_PATTERNS.join('\n'));
@ -50328,7 +50328,7 @@ async function processCacheKeyTemplate(template) {
cache_key_prefix: cacheKeyPrefix,
platform,
file_hash: fileHash,
mise_env: MISE_ENV,
mise_env: miseEnv,
install_args_hash: installArgsHash
};
// Calculate the default cache key by processing the default template

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

6
package-lock.json generated
View file

@ -454,7 +454,6 @@
"integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.27.1",
"@babel/generator": "^7.28.3",
@ -2031,7 +2030,6 @@
"integrity": "sha512-EHrrEsyhOhxYt8MTg4zTF+DJMuNBzWwgvvOYNj/zm1vnaD/IC5zCXFehZv94Piqa2cRFfXrTFxIvO95L7Qc/cw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.44.1",
"@typescript-eslint/types": "8.44.1",
@ -2575,7 +2573,6 @@
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@ -2841,7 +2838,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"caniuse-lite": "^1.0.30001737",
"electron-to-chromium": "^1.5.211",
@ -3332,7 +3328,6 @@
"integrity": "sha512-TS9bTNIryDzStCpJN93aC5VRSW3uTx9sClUn4B87pwiCaJh220otoI0X8mJKr+VcPtniMdN8GKjlwgWGUv5ZKA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.12.1",
@ -6286,7 +6281,6 @@
"integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"

View file

@ -396,7 +396,7 @@ async function processCacheKeyTemplate(template: string): Promise<string> {
const version = core.getInput('version')
const installArgs = core.getInput('install_args')
const cacheKeyPrefix = core.getInput('cache_key_prefix') || 'mise-v0'
const { MISE_ENV } = process.env
const miseEnv = process.env.MISE_ENV?.replace(/,/g, '-')
const platform = await getTarget()
// Calculate file hash
@ -421,7 +421,7 @@ async function processCacheKeyTemplate(template: string): Promise<string> {
cache_key_prefix: cacheKeyPrefix,
platform,
file_hash: fileHash,
mise_env: MISE_ENV,
mise_env: miseEnv,
install_args_hash: installArgsHash
}