name: Auto-fix
on:
  push:
  pull_request:
jobs:
  style:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - name: Install Python dependencies
        run: |
          python -m pip install --upgrade hatch
      - name: Fix code style
        run: hatch run style:fix --fix-only
      - name: Check if any edits are necessary
        run: git diff --color --exit-code
      - name: Apply automatic fixes using pre-commit-ci-lite
        if: failure() && github.event_name == 'pull_request'
        uses: pre-commit-ci/lite-action@v1.0.1
