Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T667: ruff cli #54

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
Loading