File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Code Formatter
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
7
+
8
+ jobs :
9
+ push_format :
10
+ runs-on : ubuntu-latest
11
+
12
+ permissions :
13
+ contents : write
14
+ pull-requests : write
15
+
16
+ steps :
17
+ - uses : actions/checkout@v4
18
+ with :
19
+ ref : ${{github.ref_name}}
20
+
21
+ - name : Set up Python ${{ matrix.python-version }}
22
+ uses : actions/setup-python@v5
23
+ with :
24
+ python-version : ${{ matrix.python-version }}
25
+
26
+ - name : Install Black and autoflake
27
+ run : pip install "black[jupyter]" autoflake
28
+
29
+ - name : Run autoflake
30
+ run : autoflake --in-place --recursive .
31
+
32
+ - name : Run Black
33
+ run : black . --exclude=".*\.ipynb$"
34
+
35
+ - name : Commit Back
36
+ continue-on-error : true
37
+ id : commitback
38
+ run : |
39
+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
40
+ git config --local user.name "github-actions[bot]"
41
+ git add --all
42
+ git commit -m "chore(format): run black on ${{github.ref_name}}"
43
+
44
+ - name : Create Pull Request
45
+ if : steps.commitback.outcome == 'success'
46
+ continue-on-error : true
47
+ uses : peter-evans/create-pull-request@v5
48
+ with :
49
+ delete-branch : true
50
+ body : " Automatically apply code formatter change"
51
+ title : " chore(format): run black on ${{github.ref_name}}"
52
+ commit-message : " chore(format): run black on ${{github.ref_name}}"
53
+ branch : formatter/${{github.ref_name}}
You can’t perform that action at this time.
0 commit comments