Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ If you need to override the download URL, you can use the `bun-download-url` inp
| Name | Description | Default | Examples |
| ------------------ | --------------------------------------------------------------------------------- | ---------------------------------------- | ------------------------------------------------ |
| `bun-version` | The version of Bun to download and install. | Version from `package.json`, or `latest` | `canary`, `1.0.0`, `1.0.x` |
| `bun-version-file` | The version of Bun to download and install from file. | `undefined` | `package.json`, `.bun-version`, `.tool-versions` |
| `bun-version-file` | The version of Bun to download and install from file. | `undefined` | `package.json`, `.bun-version`, `.tool-versions`, `mise.toml` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Document .mise.toml alongside mise.toml.

FILE_VERSION_READERS now supports both mise.toml and .mise.toml, but the input docs only mention the non-hidden filename. That leaves the new supported variant effectively undocumented for users.

Suggested doc tweak
-| `bun-version-file` | The version of Bun to download and install from file.                             | `undefined`                              | `package.json`, `.bun-version`, `.tool-versions`, `mise.toml` |
+| `bun-version-file` | The version of Bun to download and install from file.                             | `undefined`                              | `package.json`, `.bun-version`, `.tool-versions`, `mise.toml`, `.mise.toml` |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `bun-version-file` | The version of Bun to download and install from file. | `undefined` | `package.json`, `.bun-version`, `.tool-versions`, `mise.toml` |
| `bun-version-file` | The version of Bun to download and install from file. | `undefined` | `package.json`, `.bun-version`, `.tool-versions`, `mise.toml`, `.mise.toml` |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 84, Update the README entry for `bun-version-file` to
document that both `mise.toml` and `.mise.toml` are supported: modify the table
cell listing example files to include `.mise.toml` (e.g., change "package.json,
mise.toml" to "package.json, mise.toml, .mise.toml"), and add a short note
referencing FILE_VERSION_READERS support if present so users know the hidden
filename is intentional.

| `bun-download-url` | URL to download .zip file for Bun release | | |
| `registry-url` | Registry URL where some private package is stored. | `undefined` | `"https://npm.pkg.github.com/"` |
| `scope` | Scope for private packages. | `undefined` | `"@foo"`, `"@orgname"` |
Expand Down
170 changes: 93 additions & 77 deletions dist/cache-save/index.js

Large diffs are not rendered by default.

146 changes: 73 additions & 73 deletions dist/setup/index.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { debug, warning } from "@actions/core";
import { parse as parseTOML } from "@iarna/toml";
import { info } from "node:console";
import { createHash } from "node:crypto";
import { existsSync, readFileSync, renameSync } from "node:fs";
Expand Down Expand Up @@ -118,6 +119,15 @@ export function getAvx2(
return avx2 ?? true;
}

const readMiseToml = (content: string) => {
const toml = parseTOML(content);
const tools = toml.tools as Record<string, unknown> | undefined;
if (!tools) return;
const bun = tools.bun;
if (typeof bun === "string") return bun;
if (Array.isArray(bun) && typeof bun[0] === "string") return bun[0];
};

const FILE_VERSION_READERS = {
"package.json": (content: string) => {
const pkg = JSON.parse(content);
Expand All @@ -127,6 +137,8 @@ const FILE_VERSION_READERS = {
content.match(/^bun\s*(?<version>.*?)$/m)?.groups?.version,
".bumrc": (content: string) => content, // https://github.com/owenizedd/bum
".bun-version": (content: string) => content,
"mise.toml": readMiseToml,
".mise.toml": readMiseToml,
};

export function readVersionFromFile(
Expand Down