Skip to content

Commit 85f7edf

Browse files
authored
Merge pull request #20 from SFI-Visual-Intelligence/christian/formatting
Add automatic formatting with ruff and import sorting (isort)
2 parents 1a664b7 + 380116b commit 85f7edf

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/format.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Format
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'utils/**'
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- 'utils/**'
14+
15+
jobs:
16+
format:
17+
name: Run Ruff and isort
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: '3.x'
28+
29+
- name: Install dependencies
30+
run: |
31+
pip install ruff isort
32+
33+
- name: Run Ruff formatter
34+
run: |
35+
ruff format utils/
36+
37+
- name: Run isort
38+
run: |
39+
isort utils/
40+
41+
- name: Commit and push changes
42+
run: |
43+
git config --global user.name "github-actions[bot]"
44+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
45+
git add utils/
46+
git commit -m "Auto-format: Applied ruff format and isort" || exit 0
47+
git push

0 commit comments

Comments
 (0)