mirror of
https://github.com/jdx/mise-action.git
synced 2026-05-14 22:00:34 +00:00
fix: read environment input in cache key computation
The cache key was being computed before setEnvVars() runs, so the environment input was never reflected in the cache key. This meant different environments would share the same cache slot. Now processCacheKeyTemplate() checks the environment input directly before falling back to process.env.MISE_ENV, ensuring the cache key includes the environment value even at cache-restore time. Also clarified action.yml description to remove confusing reference to env input. Fixes issue identified by Greptile review.
This commit is contained in:
parent
7a80676ac1
commit
74e6914774
4 changed files with 14 additions and 5 deletions
|
|
@ -89,8 +89,8 @@ inputs:
|
|||
required: false
|
||||
description: |
|
||||
The mise environment to use (e.g., "preview", "production").
|
||||
When set, this value will be exported to GITHUB_ENV (if env input is true),
|
||||
making it available to all subsequent workflow steps.
|
||||
When set, this value will be exported to GITHUB_ENV, making it available
|
||||
to all subsequent workflow steps.
|
||||
Note: If MISE_ENV is already set in the environment, it takes precedence over this input.
|
||||
outputs:
|
||||
cache-hit:
|
||||
|
|
|
|||
5
dist/index.js
generated
vendored
5
dist/index.js
generated
vendored
|
|
@ -85189,7 +85189,10 @@ async function processCacheKeyTemplate(template) {
|
|||
const version = getInput('version');
|
||||
const installArgs = getInput('install_args');
|
||||
const cacheKeyPrefix = getInput('cache_key_prefix') || 'mise-v1';
|
||||
const miseEnv = process.env.MISE_ENV?.replace(/,/g, '-');
|
||||
// Check environment input first, then fall back to process.env.MISE_ENV
|
||||
// This ensures the cache key includes the environment even before setEnvVars() runs
|
||||
const environmentInput = getInput('environment');
|
||||
const miseEnv = (environmentInput || process.env.MISE_ENV || '').replace(/,/g, '-');
|
||||
const platform = await getTarget();
|
||||
// Calculate file hash
|
||||
const fileHash = await hashFiles(MISE_CONFIG_FILE_PATTERNS.join('\n'));
|
||||
|
|
|
|||
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
|
|
@ -456,7 +456,13 @@ 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-v1'
|
||||
const miseEnv = process.env.MISE_ENV?.replace(/,/g, '-')
|
||||
// Check environment input first, then fall back to process.env.MISE_ENV
|
||||
// This ensures the cache key includes the environment even before setEnvVars() runs
|
||||
const environmentInput = core.getInput('environment')
|
||||
const miseEnv = (environmentInput || process.env.MISE_ENV || '').replace(
|
||||
/,/g,
|
||||
'-'
|
||||
)
|
||||
const platform = await getTarget()
|
||||
|
||||
// Calculate file hash
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue