-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (35 loc) · 1.16 KB
/
format-fixer.yml
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
name: Auto-Format Python Code
on:
push:
branches:
- dev
- master
paths:
- '**.py'
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python environment
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
pip install black isort flake8 autoflake
- name: Remove unused imports with autoflake
run: autoflake --in-place --remove-all-unused-imports --remove-unused-variables --recursive . --exclude apps.py
- name: Format code with isort
run: isort .
- name: Format code with Black
run: black .
- name: Commit the generated schema
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 🤖 Auto-formated Python code
# this gives the commit author the github bot pfp and username
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com
file_pattern: "*.py"