Add tox -e lint
to GHA
#7
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: Autoformat code and metadata | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ master ] | |
jobs: | |
run-and-apply: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Install dependencies | |
run: pip install --upgrade pip setuptools wheel "tox<4.0.0" | |
- name: Permission workaround | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Run formatter | |
run: tox -e lint | |
- name: Commit all changes | |
run: | | |
if [[ `git status --porcelain` ]]; then | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Apply code formatting" | |
git push | |
fi | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install test requirements | |
run: | | |
python3 -m pip install -r requirements.txt | |
- name: Run tests | |
run: | | |
make test |