Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

Commit

Permalink
adding black.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tannuiscoding authored and iamyaash committed Oct 30, 2024
1 parent c385dfa commit cbf3cfa
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Black Code Formatter

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

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: Commit and push changes
if: ${{ steps.action_black.outcome == 'success' }}
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"
git push

0 comments on commit cbf3cfa

Please sign in to comment.