Created
July 28, 2020 13:46
-
-
Save itsvinayak/2beb4751db5b9ff332d441f1acde9786 to your computer and use it in GitHub Desktop.
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: autoblack_on_push | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-python@v2 | |
- run: pip install black isort | |
- run: black --check . | |
- name: If needed, commit black changes to a new pull request | |
if: failure() | |
run: | | |
black . | |
isort --profile black . | |
git config --global user.name github-actions | |
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com' | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git commit -am "fixup! Format Python code with psf/black push" | |
git push --force origin HEAD:$GITHUB_REF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment