Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 4, 2026

When no bun-version or bun-version-file input is provided, the action now automatically reads the bun version from package.json, falling back to latest if not found.

Changes

  • Version resolution priority: bun-version input → bun-version-file input → package.json packageManager field → package.json engines.bun field → latest
  • Silent mode for automatic checks: Added optional silent parameter to readVersionFromFile() to suppress warnings when automatically checking package.json
  • Backward compatible: Existing workflows continue to work unchanged

Example

# Before: required explicit version
- uses: oven-sh/setup-bun@v2
  with:
    bun-version: latest

# After: reads from package.json automatically
- uses: oven-sh/setup-bun@v2

With package.json:

{
  "packageManager": "bun@1.0.25"
}

The action will now install Bun 1.0.25 without requiring explicit configuration.

Original prompt

This section details on the original issue you should resolve

<issue_title>feat: make packageManager from package.json as default bun version</issue_title>
<issue_description>if packageManager doesn't exist, then latest</issue_description>

Comments on the Issue (you are @copilot in this section)

@xhyrom I think this makes perfect sense :)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 4, 2026 23:32
Co-authored-by: xhyrom <56601352+xhyrom@users.noreply.github.com>
Co-authored-by: xhyrom <56601352+xhyrom@users.noreply.github.com>
Co-authored-by: xhyrom <56601352+xhyrom@users.noreply.github.com>
Copilot AI changed the title [WIP] Set packageManager as default bun version feat: use packageManager from package.json as default bun version Jan 4, 2026
Copilot AI requested a review from xhyrom January 4, 2026 23:37
@xhyrom xhyrom marked this pull request as ready for review January 5, 2026 00:00
Copilot AI review requested due to automatic review settings January 5, 2026 00:00
Copy link
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

This PR enhances the setup-bun action to automatically detect the Bun version from package.json when no explicit version is provided. The action now follows a priority chain: bun-version input → bun-version-file input → package.json packageManager field → package.json engines.bun field → latest. This makes the action more convenient to use while maintaining full backward compatibility.

Key Changes:

  • Added automatic version detection from package.json as a fallback when no explicit version inputs are provided
  • Introduced a silent parameter to readVersionFromFile() to suppress warnings during automatic version detection
  • Added comprehensive test coverage for the new functionality

Reviewed changes

Copilot reviewed 4 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/index.ts Added automatic fallback to read Bun version from package.json with silent mode enabled
src/utils.ts Enhanced readVersionFromFile function with optional silent parameter to suppress warnings during automatic checks
tests/utils.spec.ts Added comprehensive test suite covering package.json version reading, silent mode behavior, and existing file format support
README.md Updated documentation to reflect new default behavior and version resolution priority chain
package-lock.json Version bump to 2.1.0 and compare-versions dependency entry (already used in codebase)

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

@xhyrom xhyrom merged commit 5639119 into main Jan 5, 2026
83 checks passed
@xhyrom xhyrom deleted the copilot/set-default-bun-version branch January 5, 2026 11:45
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.

feat: make packageManager from package.json as default bun version

2 participants