Skip to content

fix(ci): use dynamic bun cache path for cross-platform support#17120

Merged
Hona merged 3 commits intoanomalyco:devfrom
Hona:fix/ci-bun-cache-windows
Mar 12, 2026
Merged

fix(ci): use dynamic bun cache path for cross-platform support#17120
Hona merged 3 commits intoanomalyco:devfrom
Hona:fix/ci-bun-cache-windows

Conversation

@Hona
Copy link
Copy Markdown
Member

@Hona Hona commented Mar 12, 2026

Summary

  • Fixes bun install cache not being restored on Windows CI runners (Blacksmith and GitHub-hosted)
  • Root cause: the cache path was hardcoded to ~/.bun/install/cache, but bun resolves the cache directory through a priority chain (BUN_INSTALL_CACHE_DIR > BUN_INSTALL > XDG_CACHE_HOME > USERPROFILE/HOME) — and ~ tilde expansion by actions/cache isn't guaranteed to match bun's actual resolution on all runner environments
  • Fix: install bun first, then use bun pm cache to get the real cache directory and feed that into actions/cache

Details

From the bun source (src/install/PackageManager/PackageManagerDirectories.zig), fetchCacheDirectoryPath resolves the install cache through:

  1. ``
  2. bunfig.toml cache_directory
  3. /install/cache/
  4. /.bun/install/cache/
  5. C:\Users\Lukem (POSIX) / %USERPROFILE% (Windows) /.bun/install/cache/
  6. Fallback: node_modules/.bun-cache

bun pm cache returns the exact resolved path, so using it as the source of truth eliminates any mismatch.

Copilot AI review requested due to automatic review settings March 12, 2026 02:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the repository’s Bun setup composite action to make Bun’s install-cache restoration reliable across CI environments (notably Windows runners) by deriving the cache directory from Bun itself rather than hardcoding a tilde-based path.

Changes:

  • Moves Bun dependency caching to occur after Bun is installed.
  • Adds a step that queries Bun’s resolved cache directory via bun pm cache and feeds it into actions/cache.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Hona Hona merged commit fafbc29 into anomalyco:dev Mar 12, 2026
7 of 8 checks passed
demostanis pushed a commit to demostanis/opencode that referenced this pull request Mar 19, 2026
demostanis pushed a commit to demostanis/opencode that referenced this pull request Mar 20, 2026
balcsida pushed a commit to balcsida/opencode that referenced this pull request Mar 24, 2026
balcsida pushed a commit to balcsida/opencode that referenced this pull request Apr 8, 2026
RobertWsp pushed a commit to RobertWsp/opencode that referenced this pull request Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants