diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 0000000..3e45bf4 --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,28 @@ +name: Pre-commit + +on: pull_request + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 # fetches all history so pre-commit can run properly + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.9' # Use Python 3.9 + + - name: Install pre-commit + run: pip install pre-commit + + - name: Run pre-commit + run: pre-commit run --all-files --show-diff-on-failure + + - name: Cache the pre-commit environment + uses: actions/cache@v3 + with: + path: ~/.cache/pre-commit + key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}