-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Autopep8 Linter | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install autopep8 | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install autopep8 | ||
- name: Run autopep8 on Python files | ||
run: | | ||
autopep8 --in-place --aggressive --aggressive --max-line-legth 100 **/*.py | ||
- name: Check for uncommitted changes | ||
run: | | ||
git config --global user.name "github-actions" | ||
git config --global user.email "github-actions@github.com" | ||
if [[ `git status --porcelain` ]]; then | ||
git add . | ||
git commit -m "Auto-format Python code with autopep8" | ||
git push | ||
else | ||
echo "No formatting changes required." |