name: autofix.ci

on:
  pull_request:
  push:
    branches: ["main"]

permissions:
  contents: read

jobs:
  autofix:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      - name: Setup Node.js
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version-file: .tool-versions
          cache: npm

      - name: Install dependencies
        run: npm ci

      - name: Run biome with auto-fix
        run: node --run lint-biome
        continue-on-error: true

      - name: Run oxlint with auto-fix
        run: node --run lint-oxlint
        continue-on-error: true

      - name: Fix website client linting
        working-directory: website/client
        run: |
          npm ci
          node --run lint
        continue-on-error: true

      - name: Fix website server linting
        working-directory: website/server
        run: |
          npm ci
          node --run lint
        continue-on-error: true

      - name: Fix browser extension linting
        working-directory: browser
        run: |
          npm ci
          node --run lint
        continue-on-error: true

      - uses: autofix-ci/action@c5b2d67aa2274e7b5a18224e8171550871fc7e4a # v1.3.4
