-
Notifications
You must be signed in to change notification settings - Fork 5
64 lines (57 loc) · 2.34 KB
/
code_style_fix.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Automatic Code Style Fix
on:
pull_request:
branches: [main]
workflow_call:
secrets:
github-token:
description: "if provided an user GH's token, it will push update; requires `push` event"
required: false
inputs:
push-fixes:
description: "if provided an user GH's token, it will push update; requires `push` event"
type: boolean
required: false
default: false
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: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
token: ${{ secrets.github-token || github.token }}
- 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"
options: "-l120 -C --target-version py38 notebooks src"
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 }}
# github_token: ${{ secrets.github-token || github.token }}
- name: Fixing Pull Request ↩️
# if: always() && inputs.push-fixes == true && steps.precommit.outcome == 'failure'
uses: actions-js/[email protected]
with:
github_token: ${{ secrets.github-token || github.token }}
message: "pre-commit: running and fixing..."
branch: ${{ github.head_ref || github.ref_name }}