mirror of
https://github.com/jdx/mise-action.git
synced 2026-05-14 22:00:34 +00:00
## Summary Refs #382 (Problem 1). The default cache key template placed `file_hash` before conditional segments (`version`, `mise_env`, `install_args_hash`). Because `@actions/cache` `restoreCache` performs prefix matching on the primary key, a key without optional trailing segments was always a prefix of a key with them, causing different workflow configurations to restore each other's caches unintentionally. ## The bug Old template: ``` {{cache_key_prefix}}-{{platform}}-{{file_hash}}{{#if version}}-{{version}}{{/if}}{{#if mise_env}}-{{mise_env}}{{/if}}{{#if install_args_hash}}-{{install_args_hash}}{{/if}} ``` Example: Workflow A (no `install_args`) produces key `mise-v0-linux-x64-<hash>`, which is a prefix of Workflow B's key `mise-v0-linux-x64-<hash>-<args_hash>`. If only B's cache exists, A restores it via prefix match. ## The fix Move `file_hash` to the end of the template so it acts as a terminator: ``` {{cache_key_prefix}}-{{platform}}{{#if version}}-{{version}}{{/if}}{{#if mise_env}}-{{mise_env}}{{/if}}{{#if install_args_hash}}-{{install_args_hash}}{{/if}}-{{file_hash}} ``` Since `file_hash` is always present, no valid cache key can be a prefix of another. Also bumps `cache_key_prefix` default from `mise-v0` to `mise-v1` (in both `src/index.ts` and `action.yml`) to intentionally invalidate existing caches that may have been saved under incorrect prefix-matched keys. ## Changes - `src/index.ts` L43: Reorder `DEFAULT_CACHE_KEY_TEMPLATE` — move `file_hash` to end - `src/index.ts` L432: Bump fallback `cache_key_prefix` from `mise-v0` to `mise-v1` - `action.yml` L46: Bump default `cache_key_prefix` from `mise-v0` to `mise-v1` - Rebuilt `dist/`
93 lines
3.2 KiB
YAML
93 lines
3.2 KiB
YAML
name: mise action
|
|
description: Actions for working with mise runtime manager
|
|
author: Jeff Dickey <@jdx>
|
|
branding:
|
|
icon: arrow-down-circle
|
|
color: purple
|
|
inputs:
|
|
version:
|
|
required: false
|
|
description: The version of mise to use. If not specified, will use the latest release.
|
|
sha256:
|
|
required: false
|
|
description: The SHA256 checksum of the mise binary to verify the download.
|
|
mise_dir:
|
|
required: false
|
|
description: |
|
|
The directory that mise will be installed to, defaults to $HOME/.local/share/mise
|
|
Or $XDG_DATA_HOME/mise if $XDG_DATA_HOME is set.
|
|
Or $MISE_DATA_DIR if $MISE_DATA_DIR is set.
|
|
tool_versions:
|
|
required: false
|
|
description: If present, this value will be written to the .tool-versions file
|
|
mise_toml:
|
|
required: false
|
|
description: If present, this value will be written to the mise.toml file
|
|
install:
|
|
required: false
|
|
default: "true"
|
|
description: if false, will not run `mise install`
|
|
install_args:
|
|
required: false
|
|
description: Arguments to pass to `mise install` such as "bun" to only install bun
|
|
install_dir:
|
|
required: false
|
|
description: deprecated
|
|
cache:
|
|
required: false
|
|
default: "true"
|
|
description: if false, action will not read or write to cache
|
|
cache_save:
|
|
required: false
|
|
default: "true"
|
|
description: if false, action will not write to cache
|
|
cache_key_prefix:
|
|
required: false
|
|
default: "mise-v1"
|
|
description: The prefix key to use for the cache, change this to invalidate the cache
|
|
cache_key:
|
|
required: false
|
|
description: |
|
|
Override the complete cache key (ignores all other cache key options).
|
|
Supports template variables: {{version}}, {{cache_key_prefix}}, {{platform}}, {{file_hash}},
|
|
{{mise_env}}, {{install_args_hash}}, {{default}}, {{env.VAR_NAME}} for environment variables,
|
|
and conditional logic like {{#if version}}...{{/if}}
|
|
experimental:
|
|
required: false
|
|
default: "false"
|
|
description: if true, will use experimental features
|
|
log_level:
|
|
required: false
|
|
default: "info"
|
|
description: The log level to use for the action
|
|
working_directory:
|
|
required: false
|
|
description: The directory that mise runs in
|
|
reshim:
|
|
required: false
|
|
default: "false"
|
|
description: if true, will run `mise reshim --all` after setting up mise
|
|
add_shims_to_path:
|
|
required: false
|
|
default: "true"
|
|
description: if false, will not add mise shims directory to PATH
|
|
github_token:
|
|
required: false
|
|
description: |
|
|
GitHub token for API authentication to avoid rate limits when installing GitHub-hosted tools.
|
|
Defaults to the automatic GitHub token.
|
|
default: ${{ github.token }}
|
|
fetch_from_github:
|
|
required: false
|
|
default: "true"
|
|
description: If true (default), fetch the mise binary from GitHub. If false and using the latest version, fetch from mise.jdx.dev instead.
|
|
env:
|
|
description: "Automatically load mise env vars into GITHUB_ENV. Note that PATH modifications are not part of this."
|
|
required: false
|
|
default: "true"
|
|
outputs:
|
|
cache-hit:
|
|
description: A boolean value to indicate if a cache was hit.
|
|
runs:
|
|
using: node20
|
|
main: dist/index.js
|