Skip to content

initial workflow

initial workflow #6

Workflow file for this run

name: Automated Code Formatting with Black
on: [push, pull_request]
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
token: ${{ secrets.BLACK_FORMATTER_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install Black
run: pip install black
- name: Format code with Black
run: black .
- name: Commit and push changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Format code with Black" || exit 0 # The exit 0 is used to prevent the workflow from failing if no changes are made
git push origin HEAD:${GITHUB_REF#refs/heads/}