---
name: pre-commit
on:
  - push
  - pull_request
env:
  PRE_COMMIT_VERSION: 4.6.0
jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-python@v7
        with:
          python-version: "3.11"
      - uses: actions/cache@v6
        with:
          key: pip-cache-v1-${{github.workflow}}-${{env.pythonLocation}}-${{env.PRE_COMMIT_VERSION}}
          path: ~/.cache/pip
      - run: python -m pip install pre-commit=="${{ env.PRE_COMMIT_VERSION }}"
        shell: bash
      - run: python -m pip freeze --local
        shell: bash
      - uses: actions/cache@v6
        with:
          path: ~/.cache/pre-commit
          key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
      - run: pre-commit run --show-diff-on-failure --color=always --all-files
        shell: bash
