Перейти до вмісту

Add to your CI pipeline

Цей контент ще не доступний вашою мовою.

Run biome ci in your pipeline to check formatting, linting, and import sorting on every push and pull request, and fail the pipeline when Biome reports an error.

Both commands run every check, but biome ci is meant for CI environments. Compared to biome check, the ci command:

  • Has no --write or --fix option.
  • Integrates better with specific runners. For example, on GitHub it prints diagnostics as GitHub annotations.
  • Lets you control the number of threads with --threads.
  • Accepts --changed, but not --staged, because a remote repository has no staged files.

See the CLI reference for every option of the ci command.

Biome provides a first-party GitHub Action that installs Biome in your runner. This workflow runs Biome on every push and pull request:

.github/workflows/biome.yml
name: Code quality
on:
push:
pull_request:
jobs:
quality:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Biome
uses: biomejs/setup-biome@v2
- name: Run Biome
run: biome ci .

The action installs the version of @biomejs/biome it finds in your lockfile, in package.json, or in the $schema field of your Biome configuration, so CI runs the same version as your project. If it finds no version, it installs the latest one. To install a specific version, set the version input of the action.

If your Biome configuration depends on a package, for example because it extends a configuration from node_modules/, set up Node.js and install your dependencies before the Run Biome step:

.github/workflows/biome.yml
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22 # or your preferred version
cache: "npm" # or 'yarn', 'pnpm'
- name: Install dependencies
run: npm ci # or yarn install --frozen-lockfile, pnpm install --frozen-lockfile

With VCS integration enabled, --changed limits Biome to the files with committed changes compared to your default branch. Staged and unstaged changes are not included.

By default, actions/checkout fetches only the latest commit, so Biome has no default branch to compare against. Set fetch-depth: 0 to fetch the full history:

.github/workflows/biome.yml
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Biome
uses: biomejs/setup-biome@v2
- name: Run Biome
run: biome ci --changed .

The community-maintained reviewdog-action-biome action runs Biome with reviewdog, which adds the diagnostics to the pull request as review comments, with commit suggestions for the fixes:

.github/workflows/reviewdog.yml
name: reviewdog
on: [pull_request]
jobs:
biome:
name: runner / Biome
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v5
- uses: mongolyy/reviewdog-action-biome@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review

Biome publishes official Docker images that GitLab CI can use to run a job. This job runs Biome on every branch and merge request:

.gitlab-ci.yml
stages:
- quality
biome:
stage: quality
image:
name: ghcr.io/biomejs/biome:latest
entrypoint: [""]
script:
- biome ci --reporter=default --reporter=gitlab --reporter-file=code-quality.json
artifacts:
reports:
codequality:
- code-quality.json
rules:
- if: $CI_COMMIT_BRANCH
- if: $CI_MERGE_REQUEST_ID

To match your project’s Biome version, replace latest with a version tag, such as 2.4.0.

The gitlab reporter creates a Code Quality report, so GitLab shows the diagnostics in your merge requests.