# Install and run Bun in GitHub Actions

Use the [`setup-bun`](https://github.com/aphrody-labs/bun/blob/main/.github/actions/setup-bun/action.yml) action of aphrody-labs/bun to install `bun` in your GitHub Actions runner. It installs a release of aphrody-labs/bun and checks it against the release's `SHA256SUMS.txt`.

```yaml workflow.yml icon="file-code"
name: my-workflow
jobs:
  my-job:
    name: my-job
    runs-on: ubuntu-latest
    steps:
      # ...
      - uses: actions/checkout@v4
      - uses: aphrody-labs/bun/.github/actions/setup-bun@main # [!code ++]

      # run any `bun` or `bunx` command
      - run: bun install # [!code ++]
      - run: bun index.ts # [!code ++]
      - run: bun run build # [!code ++]
```

---

To specify a version of Bun to install:

```yaml workflow.yml icon="file-code"
name: my-workflow
jobs:
  my-job:
    name: my-job
    runs-on: ubuntu-latest
    steps:
      # ...
      - uses: aphrody-labs/bun/.github/actions/setup-bun@main
        with: # [!code ++]
          bun-version: 1.4.3 # or "latest", or a tag such as "aphrody-v1.4.3-aphrody.4" # [!code ++]
```

---

To type check your project, run [`bun check`](https://bun.aphrody.com/docs/runtime/check#run-in-ci). GitHub shows each type error as an annotation on the pull request diff.

```yaml workflow.yml icon="file-code"
name: my-workflow
jobs:
  my-job:
    name: my-job
    runs-on: ubuntu-latest
    steps:
      # ...
      - uses: actions/checkout@v4
      - uses: aphrody-labs/bun/.github/actions/setup-bun@main
      - run: bun install
      - run: bun check # [!code ++]
```

---

See the [`setup-bun` action](https://github.com/aphrody-labs/bun/blob/main/.github/actions/setup-bun/action.yml) for all options.
