mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
chore: add pre-commit
This commit is contained in:
parent
dd7768206c
commit
b82c24ad07
3 changed files with 278 additions and 0 deletions
33
.github/workflows/pre-commit.yml
vendored
Normal file
33
.github/workflows/pre-commit.yml
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
name: pre-commit
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
pre-commit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Required for detecting diffs
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Install pre-commit
|
||||
run: |
|
||||
pip install pre-commit
|
||||
|
||||
- name: Run pre-commit on changed files
|
||||
run: |
|
||||
CHANGED_FILES=$(git diff --name-only origin/main...HEAD | tr '\n' ' ')
|
||||
if [ -n "$CHANGED_FILES" ]; then
|
||||
pre-commit run --files $CHANGED_FILES
|
||||
else
|
||||
echo "No changed files to check."
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue