name: Run pre-commit
on:
  pull_request:
    types:
      - opened
      - edited
      - reopened
      - synchronize
jobs:
  pre-commit:
    name: Run pre-commit
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
        with:
          fetch-depth: 0
      - name: Set up Python
        uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
        with:
          python-version: 3.12
      - name: Run pre-commit
        run: |
          python -m pip install --upgrade pip
          pip install pre-commit
          pre-commit install
          pre-commit run --all-files --show-diff-on-failure
