summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ruff-lint.yml44
1 files changed, 27 insertions, 17 deletions
diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml
index 6ba9447..e875dea 100644
--- a/.github/workflows/ruff-lint.yml
+++ b/.github/workflows/ruff-lint.yml
@@ -17,23 +17,33 @@ jobs:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- - name: Get changed py files
- id: changed-py-files
- uses: tj-actions/changed-files@v44
+ - name: Filter changed Python files
+ id: py-filter
+ uses: dorny/paths-filter@v3
with:
- files: |
- **.py
+ list-files: json
+ filters: |
+ python:
+ - '**/*.py'
- - name: Ruff Check
- if: steps.changed-py-files.outputs.any_changed == 'true'
- uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b
- with:
- args: check
- changed-files: 'true'
+ - name: Get py changed files
+ if: steps.py-filter.outputs.python == 'true'
+ id: py-changed-files
+ run: |
+ files=$(echo '${{ steps.py-filter.outputs.python_files }}' | jq -r 'join(" ")')
+ echo "files=${files}" >> $GITHUB_OUTPUT
- - name: Ruff Format
- if: always() && steps.changed-py-files.outputs.any_changed == 'true'
- uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b
- with:
- args: format --diff
- changed-files: 'true' \ No newline at end of file
+ - name: Install ruff
+ if: steps.py-filter.outputs.python == 'true'
+ run: |
+ pip install ruff==0.6.4
+
+ - name: Run ruff check on changed files
+ if: steps.py-filter.outputs.python == 'true'
+ run: |
+ ruff check ${{ steps.py-changed-files.outputs.files }}
+
+ - name: Run ruff format on changed files
+ if: always() && steps.py-filter.outputs.python == 'true'
+ run: |
+ ruff format --diff ${{ steps.py-changed-files.outputs.files }} \ No newline at end of file