Skip to content

Commit d17ffa0

Browse files
committed
linting workflow
1 parent cbbabdc commit d17ffa0

File tree

2 files changed

+61
-15
lines changed

2 files changed

+61
-15
lines changed

.github/README_PUBLISHING.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,7 @@ This project uses Ruff for linting and formatting. The workflow enforces these s
5353

5454
To run the same checks locally:
5555
```bash
56-
# Install Ruff
57-
pip install ruff
58-
59-
# Run linting
60-
ruff check .
61-
62-
# Check formatting
63-
ruff format --check .
64-
65-
# Auto-fix issues where possible
66-
ruff check --fix .
67-
ruff format .
68-
69-
# Use Black to format the code
70-
black .
56+
./format.sh
7157
```
7258

7359
## Troubleshooting

.github/workflows/linting.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Format Check
2+
3+
on:
4+
pull_request:
5+
branches: [ main, master ]
6+
paths:
7+
- '**.py'
8+
- 'evals/**'
9+
- 'stagehand/**'
10+
- 'format.sh'
11+
- 'pyproject.toml'
12+
13+
jobs:
14+
format-check:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.10'
26+
27+
- name: Install formatting dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install black isort ruff
31+
32+
- name: Make format script executable
33+
run: chmod +x ./format.sh
34+
35+
- name: Check current formatting status
36+
run: |
37+
echo "Checking current code formatting..."
38+
# Create a backup of current state
39+
git stash push -m "backup before format check"
40+
41+
- name: Run format script
42+
run: ./format.sh
43+
44+
- name: Check for formatting changes
45+
run: |
46+
if git diff --quiet; then
47+
echo "✅ Code is properly formatted!"
48+
exit 0
49+
else
50+
echo "❌ Code formatting issues detected!"
51+
echo ""
52+
echo "The following files need formatting:"
53+
git diff --name-only
54+
echo ""
55+
echo "Please run './format.sh' locally and commit the changes."
56+
echo ""
57+
echo "Detailed changes:"
58+
git diff
59+
exit 1
60+
fi

0 commit comments

Comments
 (0)