Skip to content

Commit

Permalink
T667: ruff cli
Browse files Browse the repository at this point in the history
  • Loading branch information
kumvijaya authored Sep 13, 2024
1 parent 765d2c1 commit 8a3b25a
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions .github/workflows/ruff-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
- 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 }}

0 comments on commit 8a3b25a

Please sign in to comment.