setup-bun

January 5, 2026 ยท View on GitHub

Download, install, and setup Bun in GitHub Actions.

Usage

- uses: oven-sh/setup-bun@v2

By default, if no version is specified, the action will:

  1. Check package.json for the packageManager field (e.g., "packageManager": "bun@1.0.25")
  2. If packageManager doesn't exist, check package.json for engines.bun
  3. If neither exists or package.json is not found, use latest

You can also explicitly specify a version:

- uses: oven-sh/setup-bun@v2
  with:
    bun-version: latest

Using version file

- uses: oven-sh/setup-bun@v2
  with:
    bun-version-file: ".bun-version"

Using custom registries

You can configure multiple package registries using the registries input. This supports both default and scoped registries with various authentication methods.

Registry configuration

- uses: oven-sh/setup-bun@v2
  with:
    registries: |
      https://registry.npmjs.org/
      @myorg:https://npm.pkg.github.com/|$GITHUB_TOKEN
      @internal:https://username:$INTERNAL_PASSWORD@registry.internal.com/

- name: Install dependencies
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    INTERNAL_PASSWORD: ${{ secrets.INTERNAL_PASSWORD }}
  run: bun install

Registry format options

TypeFormat
Default registryhttps://registry.example.com/
Default registry with tokenhttps://registry.example.com/|$TOKEN
Scoped registry@scope:https://registry.example.com/
Scoped registry with token@scope:https://registry.example.com/|$TOKEN
Scoped registry with URL credentials@scope:https://username:$PASSWORD@registry.example.com/

Important

When using authentication, make sure to set the corresponding environment variables in your workflow steps that need access to the registries.

For more information about configuring registries in Bun, see the official documentation.

Override download url

If you need to override the download URL, you can use the bun-download-url input.

- uses: oven-sh/setup-bun@v2
  with:
    bun-download-url: "https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip"

Inputs

NameDescriptionDefaultExamples
bun-versionThe version of Bun to download and install.Version from package.json, or latestcanary, 1.0.0, 1.0.x
bun-version-fileThe version of Bun to download and install from file.undefinedpackage.json, .bun-version, .tool-versions
bun-download-urlURL to download .zip file for Bun release
registry-urlRegistry URL where some private package is stored.undefined"https://npm.pkg.github.com/"
scopeScope for private packages.undefined"@foo", "@orgname"
no-cacheDisable caching of the downloaded executable.falsetrue, false
tokenPersonal access token (PAT) used to fetch tags from the oven-sh/bun repository.${{ github.token }}${{ secrets.GITHUB_TOKEN }}

Outputs

NameDescriptionExample
bun-versionThe output from bun --version.1.0.0
bun-revisionThe output from bun --revision.1.0.0+822a00c4
bun-pathThe path to the Bun executable./path/to/bun
bun-download-urlThe URL from which Bun was downloaded.https://bun.sh/download/latest/linux/x64?avx2=true&profile=false
cache-hitIf the Bun executable was read from cache.true