File tree Expand file tree Collapse file tree 3 files changed +32
-5
lines changed
Expand file tree Collapse file tree 3 files changed +32
-5
lines changed Original file line number Diff line number Diff line change 2323 with :
2424 python-version : ' 3.10'
2525
26- - name : Check format and lint
26+ - name : Cache pre-commit environments
27+ uses : actions/cache@v4
28+ with :
29+ path : ~/.cache/pre-commit
30+ key : pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
31+ restore-keys : |
32+ pre-commit-${{ runner.os }}-
33+
34+ - name : Install and setup pre-commit
35+ run : |
36+ echo "Pre-commit version: $(pre-commit --version)"
37+ pre-commit install-hooks
38+
39+ - name : Run pre-commit checks
40+ run : |
41+ echo "Running all pre-commit hooks..."
42+ pre-commit run --all-files --show-diff-on-failure
43+
44+ - name : Check for uncommitted changes
2745 run : |
28- pip list | grep -E 'ruff|mypy' # show ruff and mypy versions
29- bash .github/workflows/scripts/check-format-and-lint.sh
46+ if [[ -n $(git status --porcelain) ]]; then
47+ echo "❌ Files were modified by pre-commit hooks. Please run 'pre-commit run --all-files' locally and commit the changes."
48+ echo "Modified files:"
49+ git status --porcelain
50+ echo "Showing diff:"
51+ git diff
52+ exit 1
53+ else
54+ echo "✅ No files were modified - all checks passed!"
55+ fi
Original file line number Diff line number Diff line change 55 # Ruff version
66 rev : v0.12.3
77 hooks :
8- # Run the linter with automatic fixes - uses [tool.ruff] config from pyproject.toml
8+ # Run the linter with fixes (CI will detect if files were modified)
99 - id : ruff-check
10- name : Ruff linter (with fixes)
10+ name : Ruff linter
1111 args : [--fix]
1212 types_or : [python, pyi, jupyter]
1313 # Run the formatter - uses [tool.ruff] config from pyproject.toml
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ dev = [
3737 " ruff==0.11.0" ,
3838 " mypy==1.15.0" ,
3939 " pytest" ,
40+ " pre-commit" ,
4041 " types-tabulate" ,
4142 " types-tqdm" ,
4243 " pandas" ,
You can’t perform that action at this time.
0 commit comments