Skip to content

Commit

Permalink
feat(ci): add GitHub Actions workflow for code formatting with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
bytexenon committed Nov 16, 2024
1 parent d614aa9 commit 8dcec84
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/black-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Black Formatter

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
format:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install Black
run: pip install black

- name: Run Black
id: black
run: |
black --check .
continue-on-error: true

- name: Commit changes
if: steps.black.outcome == 'failure'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
black .
git add .
git commit -m "style: format code with Black"
git push

0 comments on commit 8dcec84

Please sign in to comment.