> ## Documentation Index
> Fetch the complete documentation index at: https://bun.zhcndoc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 在 GitHub Actions 中使用 Bun 安装依赖

使用官方的 [`setup-bun`](https://github.com/oven-sh/setup-bun) GitHub Action 在你的 GitHub Actions 执行器中安装 `bun`。

```yaml workflow.yml icon="file-code" theme={"theme":{"light":"github-light","dark":"dracula"}}
title: my-workflow
jobs:
  my-job:
    title: my-job
    runs-on: ubuntu-latest
    steps:
      # ...
      - uses: actions/checkout@v4
      - uses: oven-sh/setup-bun@v2 // [!code ++]

      # 运行任意 `bun` 或 `bunx` 命令
      - run: bun install // [!code ++]
```

***

指定要安装的 Bun 版本：

```yaml workflow.yml icon="file-code" theme={"theme":{"light":"github-light","dark":"dracula"}}
title: my-workflow
jobs:
  my-job:
    title: my-job
    runs-on: ubuntu-latest
    steps:
      # ...
      - uses: oven-sh/setup-bun@v2
         with: # [!code ++]
          version: "latest" # 或 "canary" # [!code ++]
```

***

完整的 `setup-bun` GitHub Action 文档，请参阅 [README.md](https://github.com/oven-sh/setup-bun)。
