-
Notifications
You must be signed in to change notification settings - Fork 9
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
1 parent
fdb40f4
commit df95dfd
Showing
1 changed file
with
24 additions
and
16 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 |
---|---|---|
@@ -1,29 +1,37 @@ | ||
name: Lint Code | ||
name: Lint and Auto-Fix Code | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
lint_and_fix: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: pip install flake8 | ||
- name: Lint with flake8 | ||
run: | | ||
pip install black isort flake8 | ||
- name: Run black (auto-fix) | ||
run: black . | ||
|
||
- name: Run isort (auto-fix) | ||
run: isort . | ||
|
||
- name: Run flake8 (lint only) | ||
run: flake8 . | ||
black: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install black | ||
run: pip install black | ||
- name: Run black | ||
run: black . --check | ||
|
||
- name: Commit and push changes if needed | ||
run: | | ||
git config --global user.name 'github-actions' | ||
git config --global user.email '[email protected]' | ||
git add -A | ||
git diff-index --quiet HEAD || git commit -m 'Apply lint auto-fixes' | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |