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.
Choose between biome check and biome ci
Section titled “Choose between biome check and biome ci”Both commands run every check, but biome ci is meant for CI environments. Compared to biome check, the ci command:
- Has no
--writeor--fixoption. - 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.
GitHub Actions
Section titled “GitHub Actions”Biome provides a first-party GitHub Action that installs Biome in your runner. This workflow runs Biome on every push and pull request:
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.
Install your dependencies
Section titled “Install your dependencies”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:
- 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-lockfileCheck only changed files
Section titled “Check only changed files”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:
- 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 .Review pull requests with reviewdog
Section titled “Review pull requests with reviewdog”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:
name: reviewdogon: [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-reviewGitLab CI
Section titled “GitLab CI”Biome publishes official Docker images that GitLab CI can use to run a job. This job runs Biome on every branch and merge request:
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_IDTo 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.
© 2023-present Biome developers and contributors.