1 parent 6c01b3c commit 8555fb4Copy full SHA for 8555fb4
1 file changed
.github/workflows/format-code.yml
@@ -0,0 +1,32 @@
1
+name: Format Code
2
+
3
+on:
4
+ pull_request:
5
+ paths:
6
+ - '**.py'
7
8
+jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - name: Set up Python
14
+ uses: actions/setup-python@v1
15
+ with:
16
+ python-version: 3.8
17
+ - name: Install dependencies
18
+ run: |
19
+ python -m pip install --upgrade pip
20
+ pip install -r requirements-lint.txt
21
+ - name: Code Format Check with Black
22
23
+ black --verbose .
24
+ - name: Commit Formated Code
25
+ uses: EndBug/add-and-commit@v5
26
+ env:
27
+ # This is necessary in order to push a commit to the repo
28
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29
30
+ message: "Format code with black"
31
+ # Ref https://git-scm.com/docs/git-add#_examples
32
+ add: './*.py'
0 commit comments