forked from open-webui/open-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (44 loc) · 1.16 KB
/
Copy pathruff.yml
File metadata and controls
49 lines (44 loc) · 1.16 KB
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
43
44
45
46
47
48
49
name: Ruff
on:
push:
branches:
- main
- dev
paths:
- 'backend/**'
- 'pyproject.toml'
pull_request:
branches:
- main
- dev
paths:
- 'backend/**'
- 'pyproject.toml'
jobs:
ruff:
name: 'Lint & Format Backend'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed Python files
id: changed
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE=${{ github.event.pull_request.base.sha }}
else
BASE=${{ github.event.before }}
fi
FILES=$(git diff --name-only --diff-filter=ACMR "$BASE" HEAD -- 'backend/**.py' | xargs)
echo "files=$FILES" >> "$GITHUB_OUTPUT"
- name: Ruff check
if: steps.changed.outputs.files != ''
uses: astral-sh/ruff-action@v3
with:
args: check ${{ steps.changed.outputs.files }}
- name: Ruff format
if: steps.changed.outputs.files != ''
uses: astral-sh/ruff-action@v3
with:
args: format --check ${{ steps.changed.outputs.files }}