Skip to content

setup-bun-with-dependencies: Update cache key pattern for bun.lock #3

@akarl-bricks

Description

@akarl-bricks

Issue

The setup-bun-with-dependencies action uses bun.lockb in the cache key pattern, but Bun 1.3.0 (and potentially other recent versions) generates bun.lock instead.

Current Behavior

The cache key in setup-bun-with-dependencies/action.yml is:

key: ${{ runner.os }}-bun-${{ inputs.bun-version }}-${{ hashFiles(format('{0}/bun.lockb', inputs.working-directory)) }}

Problem

  • Bun 1.3.0 creates bun.lock (text format) not bun.lockb (binary format)
  • The hashFiles('**/bun.lockb') pattern doesn't match bun.lock, resulting in a cache key based on an empty hash
  • This breaks cache invalidation when dependencies change

Suggested Fix

Update the cache key pattern to match both formats:

key: ${{ runner.os }}-bun-${{ inputs.bun-version }}-${{ hashFiles(format('{0}/bun.lock*', inputs.working-directory)) }}

Or more specifically:

key: ${{ runner.os }}-bun-${{ inputs.bun-version }}-${{ hashFiles(format('{0}/bun.lock', inputs.working-directory), format('{0}/bun.lockb', inputs.working-directory)) }}

Context

Discovered while migrating common-resources from npm to bun. The repo has bun.lock and the action works but caching isn't optimally keyed.

Metadata

Metadata

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions