Add pre commit (#26)
This commit is contained in:
22
.github/workflows/pre-commit.yml
vendored
22
.github/workflows/pre-commit.yml
vendored
@@ -13,9 +13,27 @@ jobs:
|
||||
OS: ${{ matrix.os }}
|
||||
PYTHON: '3.10'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v3
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Update setuptools and wheel
|
||||
run: |
|
||||
pip install setuptools==68.2.2 wheel==0.41.2
|
||||
- name: Install pre-commit
|
||||
run: |
|
||||
pip install pre-commit
|
||||
- name: Install pre-commit hooks
|
||||
run: |
|
||||
pre-commit install
|
||||
- name: Run pre-commit
|
||||
run: |
|
||||
pre-commit run --all-files > pre-commit.log 2>&1 || true
|
||||
cat pre-commit.log
|
||||
if grep -q Failed pre-commit.log; then
|
||||
echo -e "\e[41m [**FAIL**] Please install pre-commit and format your code first. \e[0m"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "\e[46m ********************************Passed******************************** \e[0m"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user