Skip to content

Commit

Permalink
Merge pull request #20 from SFI-Visual-Intelligence/christian/formatting
Browse files Browse the repository at this point in the history
Add automatic formatting with ruff and import sorting (isort)
  • Loading branch information
salomaestro authored Jan 30, 2025
2 parents 1a664b7 + 380116b commit 85f7edf
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Format

on:
push:
branches:
- main
paths:
- 'utils/**'
pull_request:
branches:
- main
paths:
- 'utils/**'

jobs:
format:
name: Run Ruff and isort
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
pip install ruff isort
- name: Run Ruff formatter
run: |
ruff format utils/
- name: Run isort
run: |
isort utils/
- name: Commit and push changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add utils/
git commit -m "Auto-format: Applied ruff format and isort" || exit 0
git push

0 comments on commit 85f7edf

Please sign in to comment.