Files
DeepTutor/.github/workflows/linting.yaml
2026-11-07 23:17:54 +08:00

47 lines
1.1 KiB
YAML

name: Linting and Formatting
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
python-lint:
name: Python Linting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit tomli
- name: Run pre-commit on Python files
run: |
echo "Running pre-commit hooks on Python files..."
pre-commit run --all-files --verbose 2>&1 || {
echo "Pre-commit checks failed! Run 'pre-commit run --all-files' locally to fix."
exit 1
}