File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change
1
+ name : Auto Format
2
+
3
+ on :
4
+ pull_request :
5
+ types : [opened, synchronize]
6
+
7
+ jobs :
8
+ autoformat :
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - uses : actions/checkout@v2
12
+ with :
13
+ ref : ${{ github.head_ref }}
14
+ - name : Set up Python
15
+ uses : actions/setup-python@v2
16
+ with :
17
+ python-version : ' 3.10'
18
+ - uses : actions/cache@v2
19
+ id : cache
20
+ with :
21
+ path : ${{ env.pythonLocation }}
22
+ key : ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v01
23
+ - name : Install Flit
24
+ if : steps.cache.outputs.cache-hit != 'true'
25
+ run : pip install flit
26
+ - name : Install Dependencies
27
+ if : steps.cache.outputs.cache-hit != 'true'
28
+ run : flit install --symlink
29
+ - uses : actions/cache@v2
30
+ id : pre-commit-hooks-cache
31
+ with :
32
+ path : ~/.cache/pre-commit
33
+ key : ${{ runner.os }}-pre-commit-hooks-${{ hashFiles('.pre-commit-config.yaml') }}-v01
34
+ - name : Run pre-commit
35
+ run : pre-commit run --all-files
36
+ - name : Commit pre-commit changes
37
+ if : failure()
38
+ run : |
39
+ git config --global user.name "pre-commit"
40
+ git config --global user.email github-actions@github.com
41
+ git add --update
42
+ git commit -m "🎨 Format code with pre-commit"
43
+ git push
You can’t perform that action at this time.
0 commit comments