Add code linting and formatting checking GitHub Action #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto-format with autopep8 | |
on: | |
pull_request: | |
branches: | |
- main | |
- dev | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install autopep8 | |
run: pip install autopep8 | |
- name: Run autopep8 | |
run: autopep8 --in-place --recursive --ignore=E5 . | |
- name: Check for uncommitted changes | |
run: | | |
if [[ $(git status --porcelain) ]]; then | |
echo "Uncommitted changes found. Please format your code with autopep8." | |
git --no-pager diff | |
exit 1 | |
fi |