Merge pull request #15 from gautierdag/pods-not-jobs #132
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: Python Code Formatting | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
formatting: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Install formatting tools | |
run: | | |
python -m pip install --upgrade pip | |
pip install black isort autoflake | |
- name: Apply formatting | |
run: | | |
isort -l 79 . | |
black -l 79 . | |
- name: Commit changes | |
run: | | |
git config --global user.name "GitHub Actions Bot" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add -A | |
git diff --quiet && git diff --staged --quiet || (git commit -m "Apply black, isort, and autoflake formatting" && git push) |