-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (36 loc) · 1.09 KB
/
ruff-lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
name: Ruff Lint
on: pull_request
jobs:
ruff-lint:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- name: Checkout Head
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Filter changed Python files
id: py-filter
uses: dorny/paths-filter@v3
with:
list-files: shell
filters: |
python:
- '**/*.py'
- 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-filter.outputs.python_files }}
- name: Run ruff format on changed files
if: always() && steps.py-filter.outputs.python == 'true'
run: |
ruff format --diff ${{ steps.py-filter.outputs.python_files }}