diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 0000000..f18921b --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,26 @@ +name: Black Formatter + +on: [push, pull_request] + +jobs: + linter_name: + name: runner / black + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check files using the black formatter + uses: psf/black@stable + id: action_black + with: + options: "--check --diff" + src: "." + - name: Annotate diff changes + if: failure() && steps.action_black.outcome != 'success' + uses: peter-evans/create-pull-request@v5 + with: + title: "Format Python code with psf/black push" + body: | + There appear to be some python formatting errors in ${{ github.sha }}. This pull request + uses the [psf/black](https://github.com/psf/black) formatter to fix these issues. + base: ${{ github.head_ref }} # Creates pull request onto pull request or commit branch + branch: actions/black