From bdd98eefe99706621f5c840ce28134dac0e794af Mon Sep 17 00:00:00 2001 From: Moritz Kern <92092328+Moritz-Alexander-Kern@users.noreply.github.com> Date: Tue, 11 Jun 2024 09:07:00 +0200 Subject: [PATCH] [MAIN] add ruff for autoformatting (#630) * add github action for ruff autoformatting --- .github/workflows/ruff-formatting.yml | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/ruff-formatting.yml diff --git a/.github/workflows/ruff-formatting.yml b/.github/workflows/ruff-formatting.yml new file mode 100644 index 000000000..ffaeefecb --- /dev/null +++ b/.github/workflows/ruff-formatting.yml @@ -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