forked from INM-6/elephant
-
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.
[MAIN] add ruff for autoformatting (NeuralEnsemble#630)
* add github action for ruff autoformatting
- Loading branch information
1 parent
6ce6558
commit bdd98ee
Showing
1 changed file
with
38 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,38 @@ | ||
name: Ruff formatting | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 12 * * 0" # Weekly at noon UTC on Sundays | ||
|
||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check with Ruff | ||
id: ruff-check | ||
uses: chartboost/ruff-action@v1 | ||
with: | ||
src: './elephant' | ||
args: 'format --check' | ||
continue-on-error: true | ||
|
||
- name: Fix with Ruff | ||
uses: chartboost/ruff-action@v1 | ||
if : ${{ steps.ruff-check.outcome == 'failure' }} | ||
with: | ||
src: './elephant' | ||
args: 'format --verbose' | ||
|
||
- name: Create PR | ||
uses: peter-evans/create-pull-request@v5 | ||
if : ${{ steps.ruff-check.outcome == 'failure' }} | ||
with: | ||
commit-message: ruff formatting | ||
title: Ruff formatting | ||
body: Reformatting code with ruff | ||
branch: ruff-formatting |