Skip to content

Commit

Permalink
Ruff and Black GitHub actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei-Aksionov committed Nov 21, 2023
1 parent e05c9b4 commit 499486a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/automatic-code-style-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Automatic Code Style Fix

on: [pull_request, pull_request_target]

jobs:
auto_code_style_fix:
runs-on: ubuntu-22.04
steps:
- name: Checkout ️🛒
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Black ◼️
uses: psf/black@stable
with:
options: "-l120 -C --target-version py38 chat eval finetune generate lit_gpt notebooks pretrain quantize scripts tests xla"
jupyter: true

- name: Ruff ®️
uses: chartboost/ruff-action@v1
with:
args: --select E,W,F,S --extend-select C4,SIM,RET,PT,I001,ANN001,ANN201,ANN205,ANN206,ARG001 --ignore E501,E731,S108,S101,S113,S603,PT007,S310,E402,PT004,C408 --per-file-ignores "*/**/__init__.py":I001,"tests/*":ANN --line-length 120 --target-version py38 --fix-only

- name: Commit files ✔️
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git diff-index --quiet HEAD || git commit -a -m "Automatic code-style fix."
- name: Pushing changes 🛠 ️
uses: ad-m/github-push-action@master
with:
branch: ${{ github.head_ref }}

0 comments on commit 499486a

Please sign in to comment.