Use pre-commit action
MODIFY
.github/workflows/main.yaml
.github/workflows/main.yaml
@@ -7,57 +7,6 @@ on:
branches: master
jobs:
- lint-black:
- name: black-formatter
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v1
- - name: Set up Python 3.8
- uses: actions/setup-python@v1
- with:
- python-version: 3.8
- - name: Install Black
- run: |
- python -m pip install black
- - name: Black Code Formatter
- run: |
- black --check --line-length 100 --skip-string-normalization .
-
- lint-flake8:
- name: flake8
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v1
- - name: Set up Python 3.8
- uses: actions/setup-python@v1
- with:
- python-version: 3.8
- - name: Install Flake8
- run: |
- python -m pip install flake8
- - name: Flake8 check
- run: |
- flake8 .
-
- lint-isort:
- name: isort
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v1
- - name: Set up Python 3.8
- uses: actions/setup-python@v1
- with:
- python-version: 3.8
- - name: Install isort
- run: |
- python -m pip install isort
- - name: isort check
- run: |
- isort --check-only .
-
test:
name: ${{ matrix.python-version }}-build
runs-on: ubuntu-latest

ADD
.github/workflows/pre-commit.yaml
+name: pre-commit
+
+on:
+ pull_request:
+ push:
+ branches: [master]
+
+jobs:
+ pre-commit:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-python@v2
+ - uses: pre-commit/action@v2.0.0

Use pre-commit action