| 12345678910111213141516171819202122232425262728293031323334353637 |
- # This is a basic workflow to help you get started with Actions
- name: Commit Format and Import Sort
- # Controls when the action will run.
- on:
- # Triggers the workflow on push or pull request events but only for the master branch
- pull_request:
- branches: [ master ]
- # push:
- # branches: [ master ]
- # A workflow run is made up of one or more jobs that can run sequentially or in parallel
- jobs:
- check:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- with: # https://github.com/stefanzweifel/git-auto-commit-action#checkout-the-correct-branch
- ref: ${{ github.head_ref }}
- - uses: actions/setup-python@v2
- - run: pip install black isort
- - run: black --check .
- - run: isort --check .
- - name: Commit isort changes to pull request
- if: failure()
- run: |
- git config --global user.name 'ndbeals'
- git config --global user.email 'ndbeals@users.noreply.github.com'
- git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
- isort .
- black .
- echo ready to commit
- git commit -am "Code formatted with black, imports sorted with isort"
- git status
- echo ready to push
- git push
|