Skip to content

Commit

Permalink
Add pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
as51340 committed Jul 22, 2024
1 parent 47b5361 commit 075e6e9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -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') }}

0 comments on commit 075e6e9

Please sign in to comment.