Skip to content

Commit 8555fb4

Browse files
authored
Process auto black (hardbyte#950)
Add black github workflow to run black and commits changed code.
1 parent 6c01b3c commit 8555fb4

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/format-code.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
run: |
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+
with:
30+
message: "Format code with black"
31+
# Ref https://git-scm.com/docs/git-add#_examples
32+
add: './*.py'

0 commit comments

Comments
 (0)