Skip to content

bold header update; docs #35

bold header update; docs

bold header update; docs #35

Workflow file for this run

name: Black Code Formatter
on:
push:
branches:
- main
permissions:
contents: write # Allow write access to repository contents
jobs:
format-code:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Black
run: pip install black
- name: Run Black Formatter
id: action_black
run: |
black package/ tests/ || echo "Black found formatting issues!"
- name: Check for changes
id: check_changes
run: |
git diff --exit-code || echo "Changes detected."
echo "changes=true" >> $GITHUB_ENV
- name: Commit and push changes
if: steps.action_black.outcome == 'success' && env.changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "style: format code with Black" || echo "No changes to commit."
git push || echo "Failed to push changes."