File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616
1717 steps :
1818 - uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0
1921
2022 - name : Set up Python ${{ matrix.python-version }}
2123 uses : actions/setup-python@v5
@@ -27,13 +29,36 @@ jobs:
2729 python -m pip install --upgrade pip
2830 pip install -e ".[dev,examples]"
2931
32+ - name : Get changed Python files
33+ id : changed
34+ run : |
35+ git fetch origin main master 2>/dev/null || true
36+ BASE="origin/main"
37+ if ! git rev-parse --verify origin/main >/dev/null 2>&1; then BASE="origin/master"; fi
38+ git diff --name-only $BASE...HEAD -- src/ tests/ examples/ | grep -E '\.py$' > changed.txt || true
39+ if [ -s changed.txt ]; then
40+ echo "has_changes=true" >> $GITHUB_OUTPUT
41+ else
42+ echo "has_changes=false" >> $GITHUB_OUTPUT
43+ fi
44+ echo "Changed files:"
45+ cat changed.txt || true
46+
3047 - name : Run ruff check
3148 run : |
32- ruff check src tests examples
49+ if [ "${{ steps.changed.outputs.has_changes }}" != "true" ]; then
50+ echo "No Python files changed, skipping ruff check"
51+ exit 0
52+ fi
53+ cat changed.txt | xargs -r ruff check --config ruff.toml
3354
3455 - name : Run ruff format check
3556 run : |
36- ruff format --check src tests examples
57+ if [ "${{ steps.changed.outputs.has_changes }}" != "true" ]; then
58+ echo "No Python files changed, skipping ruff format"
59+ exit 0
60+ fi
61+ cat changed.txt | xargs -r ruff format --check --config ruff.toml
3762
3863 - name : Run pyright
3964 run : |
You can’t perform that action at this time.
0 commit comments