Commit graph

35 commits

Author SHA1 Message Date
jdx
ac8a6414ec
feat: add wings_enabled input (mise-wings cache integration) (#454)
## Summary

Adds two new inputs that gate the mise-wings asset cache for tool
installs. Existing workflows are unaffected: default `wings_enabled:
false` is a no-op.

| Input | Default | Description |
|---|---|---|
| `wings_enabled` | `false` | Route tool-install URLs through the wings
cache when `true` |

## How it works

When `wings_enabled: true`, the action exports `MISE_WINGS_ENABLED=1`.
Authentication is **fully automatic** — mise itself owns the GHA OIDC →
wings session exchange. No `mise wings login` step in workflow YAML, no
long-lived secrets to rotate.

When mise (built with wings support — see
[jdx/mise#9458](https://github.com/jdx/mise/pull/9458)) sees
`MISE_WINGS_ENABLED=1` and detects the GHA OIDC env vars
(`ACTIONS_ID_TOKEN_REQUEST_URL` + `ACTIONS_ID_TOKEN_REQUEST_TOKEN`), it:

1. Fetches the runner's OIDC token, scoped to the wings deployment
audience
2. POSTs it to `https://api.<host>/auth` to mint a wings CI session JWT
3. Caches the JWT in-process for the rest of the workflow run
4. Transparently rewrites `registry.npmjs.org` / `github.com` /
`api.github.com` URLs to the corresponding wings cache subdomains and
attaches the JWT as a Bearer header

## Why opt-in (not opt-out)

The default-off posture is deliberate. Many workflows already declare
`permissions: id-token: write` for unrelated reasons (SLSA provenance,
AWS OIDC, Sigstore, npm provenance, etc.). If `wings_enabled` defaulted
to `true`, those workflows would silently send the runner's OIDC
identity claims to a third-party cache without explicit consent. Cursor
Bugbot HIGH + Greptile P1+security correctly flagged the previous
"default true" iteration of this PR as a privacy regression.

Explicit opt-in keeps the gate visible in the workflow YAML.

## Workflow requirements

```yaml
permissions:
  id-token: write   # required for OIDC

jobs:
  build:
    steps:
      - uses: jdx/mise-action@<sha>
        with:
          wings_enabled: true
```

The action emits a clear warning when `wings_enabled: true` but
`id-token: write` is missing — without that hint, the user would see
"wings configured but doing nothing" and have no clue why.

## Test plan

- [x] `npm run all` — format + lint + package, clean
- [x] `dist/index.js` rebuilt and contains the wings hook (greppable:
`MISE_WINGS_ENABLED`, `setupWings`)
- [ ] End-to-end: a workflow with `wings_enabled: true`, `permissions:
id-token: write`, an active wings subscription, and a recent enough
`mise` binary. The mise repo's own `docs.yml` will exercise this path
once [jdx/mise#9458](https://github.com/jdx/mise/pull/9458) is merged.
- [ ] Default-off path: a workflow without the `wings_enabled` input
behaves identically to today.

## Out of scope

- Older mise binaries will see `MISE_WINGS_ENABLED` and silently ignore
it (no wings client code) — that's intended; the action doesn't gate on
mise version.
- Self-hosted runners: `permissions: id-token: write` only does anything
on GitHub-hosted runners by default. Self-hosted runners need extra
config; the warning above is conservative enough for both cases.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Introduces an opt-in path that can cause OIDC-based authentication to
a third-party cache and alters tool download routing when enabled.
Default-off behavior limits impact, but misconfiguration could create
confusing cache bypass or unexpected network/token exchange behavior.
> 
> **Overview**
> Adds a new **experimental** `wings_enabled` action input (default
`false`) to opt workflows into the mise-wings asset cache by exporting
`MISE_WINGS_ENABLED=1`.
> 
> When enabled, the action now runs `setupWings()` early to set the env
var and warn if GitHub OIDC env vars are missing (i.e., `permissions:
id-token: write` not configured), while leaving existing/default
behavior unchanged.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
969042fe52. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-04-29 09:36:39 -05:00
Orkun Tümer
35ed1d362d
feat!: Update Node.js version from 20 to 24 (#395)
Fixes https://github.com/jdx/mise-action/issues/394

This PR updates the GitHub Actions runner environment to use Node.js 24,
following the deprecation notice for Node.js 20. GitHub has announced
that starting June 2, 2026, Node.js 24 will become the default, and
earlier versions will be restricted to ensure security and performance
standards.

The jdx/mise-action@v3 currently triggers a deprecation warning because
it defaults to the Node.js 20 runtime. To proactively address this and
avoid potential workflow failures during the transition period, we are
opting into the newer runtime version now.

Co-authored-by: jdx <216188+jdx@users.noreply.github.com>
2026-03-13 12:06:18 +01:00
Kyle Altendorf
f1c6089fba
fix: move file_hash to end of cache key template to prevent prefix matching (#384)
## 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/`
2026-02-21 07:58:21 -06:00
Scott Robinson
5ff8b6c870
docs: fix description for mise_toml input (#351)
As of 5d3e058 , the contents of the `mise_toml` input writes to
`mise.toml` and _not_ the dotfile `.mise.toml` as documented.
2026-01-05 13:13:32 +00:00
jdx
61e6c4a9e9
feat: add option to disable shims in PATH (#340)
## Summary
- Add `add_shims_to_path` input (default: `true`) to control whether the
mise shims directory is added to PATH
- Setting this to `false` allows users who already have mise configured
to avoid conflicts with their existing setup

Fixes #337

## Usage
```yaml
- uses: jdx/mise-action@v2
  with:
    add_shims_to_path: false
```

## Test plan
- [ ] Verify shims are added to PATH by default (existing behavior)
- [ ] Verify shims are NOT added to PATH when `add_shims_to_path: false`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds `add_shims_to_path` input (default true) to optionally skip
adding `mise/shims` to PATH.
> 
> - **Action input/behavior**
>   - Add `inputs.add_shims_to_path` (default: `true`).
> - Conditionally add `mise/shims` to `PATH` only when
`add_shims_to_path` is `true`.
> - **Build/dist updates (non-functional to action API)**
> - Minor runtime tweaks in bundled libs: safer `abortSignal`
reassignment, improved `File` stream creation, user-agent OS field
formatting, `randomUUID` fallback for Node, and updated internal SDK
version constants.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f90b26afa3. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-12-16 15:39:27 +00:00
jdx
dd7e7f5e0a
Revert "feat(action): moved save cache to post step" (#329)
Reverts jdx/mise-action#321

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is
generating a summary for commit
76cb660eb1. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-11-24 12:02:32 +00:00
Amadeusz Kryze
79b896a39d
feat(action): moved save cache to post step (#321)
Fixes #199

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-20 15:52:34 -06:00
Pedro Piñera Buendía
0f242c8c39
feat: add environment variable support to cache key templates (#250)
I added support for customizing the key, but forgot the most important
piece that we need, being able to reference an environment variable
value. Our CI runner provider is now exposing an environment variable
that indicates if the OS configuration changes, and we plan to use that
one to invalidate the cache, otherwise we get errors because the cached
dependencies are linking against an invalid / non-existent `glibc`
version.

> [!IMPORTANT]
> I wrote the code with `claude code` and reviewed it afterwards

## Summary (Claude-generated)
- Add support for `{{env.VAR_NAME}}` syntax in cache key templates to
allow reading environment variable values
- Enables more flexible cache key customization based on CI/CD
environment variables like branch names, deployment environments, or
custom build identifiers
- Maintains backward compatibility with existing cache key templates

## Examples
```yaml
# Include branch name from environment
cache_key: 'mise-{{env.GITHUB_REF_NAME}}-{{platform}}-{{file_hash}}'

# Use custom deployment environment
cache_key: 'mise-{{env.DEPLOY_ENV}}-{{platform}}-{{file_hash}}'

# Conditional logic with environment variables
cache_key: '{{default}}{{#if env.CUSTOM_SUFFIX}}-{{env.CUSTOM_SUFFIX}}{{/if}}'
```

## Changes
- Modified `processCacheKeyTemplate()` in `src/index.ts` to include
`process.env` in template data
- Updated `action.yml` documentation to include the new
`{{env.VAR_NAME}}` syntax
- All existing functionality remains unchanged

## Test plan
- [x] Build and package successfully with `npm run all`
- [x] Linting and formatting pass
- [ ] Manual testing with environment variables in cache key templates
- [ ] Verify backward compatibility with existing cache key
configurations
2025-08-22 05:04:00 -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
Mael
f0b1d70eae
feat: export env vars from mise.toml (#241)
Solve https://github.com/jdx/mise-action/issues/36

BREAKING CHANGE: we're defaulting this behavior to `true`

---------

Co-authored-by: jdx <216188+jdx@users.noreply.github.com>
2025-08-18 16:33:13 +00:00
jdx
adbb7adcf1
feat: allow fetching binary from mise.jdx.dev (#227)
THANKS CLOUDFLARE FOR PROJECT ALEXANDRIA
2025-07-24 06:09:13 +00:00
Gregor Zeitlinger
ca07392817
support checksum (#218)
* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum

* support checksum
2025-07-12 06:17:19 -05: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
jdx
81d53cf968
fix: save cache when build fails
Fixes #99
2025-04-22 22:41:39 -05:00
Jeff Dickey
2e6a26bb55
fix: deprecated install_dir 2024-06-01 11:12:06 -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
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
55e5d18e74
added rtx_dir config (#215)
* added rtx_dir config

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip
2023-12-14 08:38:00 -06: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
Robbie Plankenhorn
0e7059cb40
Added ability to disable automatic action caching. (#212) 2023-12-12 15:04:07 -06:00
jdx
d661017ade
updated action template base from actions/typescript-action (#170) 2023-10-16 19:18:57 -05:00
Yuya Kusakabe
50bd58fbe0
Add install option to skip rtx install (#146) 2023-09-15 00:49:51 +00:00
Jeff Dickey
ae8876954e
jdxcode -> jdx 2023-08-27 12:12:44 -05:00
Yousif Akbar
10114e7e8a
Adding Setting of Necessary Environment Variables Before Running rtx (#123)
* Fixing typo in outputs of action.yml

* Adding `setEnvVars` step for env vars that should always be set in the action
2023-08-18 15:29:16 +00:00
Nick Hehr
801b2f548d
feat: add support for saving / restoring rtx cache (#64)
* feat: add support for saving / restoring rtx cache

* fix: add support for .rtx.toml to file hash
2023-04-11 00:36:00 +00:00
Jeff Dickey
466110084b change action name 2023-02-21 23:52:09 -06:00
Jeff Dickey
7a0340b0dc branding 2023-02-21 23:26:41 -06:00
Jeff Dickey
386756bf18
Update action.yml 2023-02-21 23:25:27 -06:00
Jeff Dickey
67b1e31166 init 2023-01-14 08:36:43 -06:00
Jeff Dickey
35f6329d75
Initial commit 2023-01-14 08:11:40 -06:00