From 8dcec8411048ee0c5d364b0106ed3323d69f3908 Mon Sep 17 00:00:00 2001 From: ByteXenon <125568681+ByteXenon@users.noreply.github.com> Date: Sat, 16 Nov 2024 15:16:48 -0700 Subject: [PATCH] feat(ci): add GitHub Actions workflow for code formatting with Black --- .github/workflows/black-format.yml | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/black-format.yml diff --git a/.github/workflows/black-format.yml b/.github/workflows/black-format.yml new file mode 100644 index 0000000..56daf34 --- /dev/null +++ b/.github/workflows/black-format.yml @@ -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