Skip to content

Add GitHub Action for Black Formatter #2

Add GitHub Action for Black Formatter

Add GitHub Action for Black Formatter #2

Workflow file for this run

name: Black Formatter
on: [push, pull_request]
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Black
run: pip install black
- name: Run Black
run: black .
- name: Commit changes
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git diff --quiet && git diff --staged --quiet || (git add . && git commit -m "Apply black formatting")
git push