Commit graph

29 commits

Author SHA1 Message Date
jdx
b287efda3d
fix: include runner image in cache key to prevent cross-provider collisions (#456)
## Problem

The default cache key was `mise-v1-{os}-{arch}-{file_hash}` — no
runner-image discriminator. Any repo whose CI runs on multiple runner
providers with the same os/arch shares one cache slot:

- github-hosted `macos-latest`
- namespace.so `nscloud-macos-sequoia-arm64-*` /
`namespace-profile-*-macos-arm64`
- self-hosted M-series macs
- BuildJet, blacksmith, etc.

When a repo migrates from one provider to another, the new run restores
the previous provider's tool installs (~200 MB of
`~/.local/share/mise/installs/*`), and tools that loaded fine in the
original image break in the new one.

### Concrete failures observed

Discovered while migrating [jdx/hk](https://github.com/jdx/hk/pull/891)
from github-hosted to namespace.so. Same `mise-v1-macos-arm64-<hash>`
cache hit on namespace; tool resolution fails everywhere:

```
mise ERROR Tool 'ubi:koalaman/shellcheck' does not have an executable named 'shellcheck'
mise ERROR Tool 'gem:asciidoctor' does not have an executable named 'asciidoctor'
mise ERROR Tool 'aqua:betterleaks/betterleaks' does not have an executable named 'betterleaks'
mise ERROR Tool 'biome' does not have an executable named 'biome'
mise ERROR Tool 'buf' does not have an executable named 'buf'
mise ERROR Tool 'github:google/google-java-format' does not have an executable named 'google-java-format'
```

— installs are present (cache restored 185 MB) but the executable layout
from the github-hosted macOS-15 image doesn't match what mise expects on
namespace's macOS arm64 image.

On Linux, cached binaries built against the github-hosted ubuntu
glibc/CPU featureset SIGILL on namespace's image (e.g. `swiftlint` exit
code 132).

## Fix

Append the GitHub Actions hosted-runner `ImageOS` env var (e.g.
`macos15`, `ubuntu24`) to the platform segment of the default cache key.
Other runners pool under `self-hosted`.

```ts
const imageOS = process.env.ImageOS || 'self-hosted'
return `${base}-${imageOS}`
```

After this change:
- `mise-v1-macos-arm64-macos15-<hash>` (github-hosted)
- `mise-v1-macos-arm64-self-hosted-<hash>` (namespace, self-hosted,
etc.)

Users with multiple self-hosted profiles that need finer scoping can set
`cache_key_prefix` per workflow. The README's docs for `{{platform}}`
are updated to reflect the new format.

## Trade-offs

- One-time cache miss for everyone on the next run after upgrade. Cache
rebuilds and stays scoped per-image after that.
- Hosted-runner image rolls (e.g. `macos15` → `macos16`) will invalidate
cache, which is desirable — that's exactly when stale binaries cause
problems.
- Self-hosted users with mixed runner pools all share one `self-hosted`
slot. They'd need `cache_key_prefix` per pool, same as before. This PR
doesn't make that worse.

## Test plan

- [ ] Verify `dist/index.js` rebuilt cleanly (yes, `npm run package`
succeeded with the change visible at `getTarget()` callsite).
- [ ] Run on a github-hosted runner — confirm `ImageOS` is read from env
(e.g. `macos15`) and shows up in the `mise cache restored from key:` log
line.
- [ ] Run on a non-hosted runner — confirm fallback to `-self-hosted`.
- [ ] Verify a workflow that switched providers no longer pulls a
poisoned cache.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes cache-key generation and will cause a one-time cache miss plus
different cache partitioning, which can affect build times and cache
reuse across runners.
> 
> **Overview**
> Updates the default cache-key `{{platform}}` value to append a runner
image discriminator (`process.env.ImageOS` on GitHub-hosted runners,
otherwise `self-hosted`), reducing cross-provider/image cache collisions
that can restore incompatible tool installs.
> 
> Implements this via a new `getRunnerImageId()` helper used during
cache-key template processing, and documents the new `{{platform}}`
format in the README; `dist/index.js` is rebuilt accordingly.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
ef1bd0e351. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-04-30 09:15:04 -05:00
Andreas Deininger
89c67a39ab
docs: bump more versions listed in README.md (#408)
This is a continuation of #407: it bumps two more version I overlooked.
2026-03-21 23:43:54 +01:00
Andreas Deininger
0409dde834
docs: bump versions listed im README.md (#407)
This PR bumps the versions mentioned in `README.md` to their latest
versions.
2026-03-21 21:24:20 +01:00
Patrick Decat
b7800bbdc8
docs: update to v3 in README (#290)
This PR updates the README to replace jdx/mise-action@v2 by
jdx/mise-action@v3 in examples.
2025-10-08 08:08:33 -05:00
Pedro Piñera Buendía
d53c31b046
feat: add configurable cache key with template variable support (#246)
I closed [this PR](https://github.com/jdx/mise-action/pull/235) by
mistake so I'm reopening it.
2025-08-19 10:59:36 -05:00
Andrew Driggs
b64166e6f5
Fix flag passed to mise reshim (#208)
* Fix flag passed to `mise reshim`

* chore: update dist after build
2025-07-15 17:30:41 -07:00
Mate Molnar
d24e3836a6
feat: pass github token for mise calls (#205) 2025-06-25 07:20:55 -05:00
Andrew Driggs
883a83c54f
Add reshim flag to reshim after setup (#202) 2025-06-17 02:03:19 -05:00
Miha Filej
c5d0c300fa
docs: restore estranged comment for tool_versions (#164) 2025-01-08 16:33:55 -06:00
Jeff Dickey
12823cc980
docs: updated README 2024-10-27 20:35:16 -05:00
Eric Matthys
81c431dc79
Update README.md to refer to v2 consistently (#96) 2024-06-20 16:37:44 -05:00
jdx
5f5bc9d57c
feat: allow passing args to install (#87) 2024-06-01 11:10:28 -05:00
Jeff Dickey
4541e25ef8
fix: rename "install_dir" config to "working_directory"
This fits in better with other actions
2024-06-01 10:37:21 -05:00
Jeff Dickey
b42d5a2f42
feat: added log level config 2024-05-12 10:19:03 -05:00
jdx
c76d578a0b
Update README.md 2024-01-10 07:57:15 -06:00
Jeff Dickey
2c307d8ed6
rtx -> mise 2024-01-02 16:16:49 -06:00
Pedro Piñera Buendía
10161a135f
Add API to enable the experimental features (#220)
* Add option to enable experimental features

* Add .rtx.toml to install the tools necessary to work on this repository
2023-12-24 19:15:25 +00:00
jdx
5ac46849ac
added rtx_toml support (#214)
* added rtx_toml support

Fixes #47

* refactor

* refactor

* bump

* bump

* bump
2023-12-14 07:56:58 -06:00
jdx
a545a9b90a
pinning (#213)
* pinning

Fixes #205

* gh

* gh

* gh

* gh

* docs
2023-12-14 12:39:54 +00:00
Jeff Dickey
f0a88fe39d
use new asset host 2023-12-11 16:37:16 -06:00
jdx
a8c1188751
Update README.md 2023-12-07 17:49:37 -06:00
jdx
9101a60cce
Update README.md 2023-12-07 17:44:17 -06:00
jdx
8942285832
Update README.md 2023-12-07 17:44:02 -06:00
jdx
d661017ade
updated action template base from actions/typescript-action (#170) 2023-10-16 19:18:57 -05:00
Jeff Dickey
ae8876954e
jdxcode -> jdx 2023-08-27 12:12:44 -05:00
Jeff Dickey
feb5cb02b0
fetch runtime from rtx.pub (#48)
removes the need to set GITHUB_TOKEN
2023-03-25 20:27:41 +00:00
Kenichi Kamiya
0410c15177 Require to specify GITHUB_TOKEN for considering API limit 2023-02-23 04:44:03 +09:00
Jeff Dickey
ed2ee922aa docs 2023-02-21 23:34:44 -06:00
Jeff Dickey
35f6329d75
Initial commit 2023-01-14 08:11:40 -06:00