Skip to content

Commit 6cd9b70

Browse files
[fix] Update CI to only check changed files
- Add tj-actions/changed-files to detect modified files in PR - Only run OpenAPI validation if openapi.yaml was changed - Only run Python linting on changed Python files (excluding legacy/) - Remove incorrect "pip install ast" dependency - Remove non-standard AST parsing and import checks - Makes CI more efficient and prevents unrelated failures
1 parent b5c94d5 commit 6cd9b70

File tree

1 file changed

+27
-34
lines changed

1 file changed

+27
-34
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,25 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v4
1515

16+
- name: Check if OpenAPI changed
17+
id: openapi-changed
18+
uses: tj-actions/changed-files@v44
19+
with:
20+
files: openapi.yaml
21+
1622
- name: Setup Node.js
23+
if: steps.openapi-changed.outputs.any_changed == 'true'
1724
uses: actions/setup-node@v4
1825
with:
1926
node-version: '18'
2027

2128
- name: Install Redoc CLI
29+
if: steps.openapi-changed.outputs.any_changed == 'true'
2230
run: |
2331
npm install -g @redocly/cli
2432
2533
- name: Validate OpenAPI specification
34+
if: steps.openapi-changed.outputs.any_changed == 'true'
2635
run: |
2736
redocly lint openapi.yaml
2837
@@ -31,47 +40,31 @@ jobs:
3140
runs-on: ubuntu-latest
3241
steps:
3342
- uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 0 # Fetch all history for proper diff
3445

46+
- name: Get changed Python files
47+
id: changed-py-files
48+
uses: tj-actions/changed-files@v44
49+
with:
50+
files: |
51+
**/*.py
52+
files_ignore: |
53+
comfyui_manager/legacy/**
54+
3555
- name: Setup Python
56+
if: steps.changed-py-files.outputs.any_changed == 'true'
3657
uses: actions/setup-python@v5
3758
with:
3859
python-version: '3.9'
3960

4061
- name: Install dependencies
62+
if: steps.changed-py-files.outputs.any_changed == 'true'
4163
run: |
42-
pip install ruff ast
64+
pip install ruff
4365
44-
- name: Run ruff linting
66+
- name: Run ruff linting on changed files
67+
if: steps.changed-py-files.outputs.any_changed == 'true'
4568
run: |
46-
ruff check comfyui_manager/glob/manager_server.py
47-
48-
- name: Check Python syntax (AST parsing)
49-
run: |
50-
python -c "
51-
import ast
52-
import sys
53-
try:
54-
with open('comfyui_manager/glob/manager_server.py', 'r') as f:
55-
ast.parse(f.read())
56-
print('Python syntax is valid')
57-
except SyntaxError as e:
58-
print(f'Syntax error: {e}')
59-
sys.exit(1)
60-
"
61-
62-
- name: Check imports and basic compilation
63-
run: |
64-
cd comfyui_manager/glob && python -c "
65-
import sys
66-
sys.path.insert(0, '../..')
67-
try:
68-
import manager_server
69-
print('Module imports successfully')
70-
except ImportError as e:
71-
print(f'Import warning: {e}')
72-
# Don't fail on import errors since dependencies may not be available
73-
except SyntaxError as e:
74-
print(f'Syntax error: {e}')
75-
sys.exit(1)
76-
"
77-
69+
echo "Changed files: ${{ steps.changed-py-files.outputs.all_changed_files }}"
70+
echo "${{ steps.changed-py-files.outputs.all_changed_files }}" | xargs -r ruff check

0 commit comments

Comments
 (0)