feat: autocommit linting (#1682)

This commit is contained in:
Ethan Knox
2024-09-08 18:36:57 -04:00
committed by GitHub
parent ff40f2447e
commit a3b9f7e0f0
2 changed files with 21 additions and 22 deletions

View File

@@ -25,10 +25,15 @@ jobs:
run: poetry run isort --profile black --check-only .
continue-on-error: true
- name: Check isort Output
if: steps.isort.outcome == 'failure'
- name: Auto-fix with isort and commit
if: steps.isort.outcome == 'failure' || ${{ !contains(github.event.issue.labels.*.name, 'check-only') }}
run: |
poetry run isort --version
poetry run python --version
echo "isort check failed. To fix, please run 'poetry run isort --profile black .'"
exit 1
poetry run isort --profile black .
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "Apply isort import ordering" || echo "No changes to commit"
git push
- name: Error if 'check-only' label is present
if: steps.isort.outcome == 'failure' && contains(github.event.issue.labels.*.name, 'check-only')
run: echo "Isort check failed. Please run 'isort .' locally to fix import orders." && exit 1