-
Notifications
You must be signed in to change notification settings - Fork 3.1k
67 lines (58 loc) · 2.92 KB
/
linting.yaml
File metadata and controls
67 lines (58 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Linting and Formatting
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
lint-and-format:
name: Linting and Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Install frontend dependencies
working-directory: ./web
run: npm ci
- name: Run pre-commit
id: pre-commit
run: pre-commit run --all-files --show-diff-on-failure
continue-on-error: true
- name: Provide fix instructions on failure
if: steps.pre-commit.outcome == 'failure'
run: |
echo ""
echo "╔═══════════════════════════════════════════════════════════════════════════╗"
echo "║ ❌ Pre-commit checks failed! ║"
echo "╠═══════════════════════════════════════════════════════════════════════════╣"
echo "║ Please run the following commands locally to fix formatting issues: ║"
echo "║ ║"
echo "║ pip install pre-commit # Install pre-commit (if not installed) ║"
echo "║ pre-commit install # Set up git hooks (recommended) ║"
echo "║ pre-commit run --all-files # Fix all formatting issues ║"
echo "║ ║"
echo "║ Then commit and push the changes. ║"
echo "║ ║"
echo "║ 💡 Tip: After running 'pre-commit install', hooks will run ║"
echo "║ automatically on every commit! ║"
echo "╚═══════════════════════════════════════════════════════════════════════════╝"
echo ""
exit 1