add black formatter action #8
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: 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 | |
continue-on-error: true | |
with: | |
options: "--check --diff" | |
src: "." | |
- name: Creating Pull Request to fix formatting errors | |
if: failure() | |
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 |