-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from SFI-Visual-Intelligence/christian/formatting
Add automatic formatting with ruff and import sorting (isort)
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |