Skip to content

Update black.yml

Update black.yml #65

Workflow file for this run

name: Black
on:
push:
branches:
- master
jobs:
format:
name: Format code with Black
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
node-version: '20'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Black
run: pip install black
- name: Run Black
run: black .
- name: Check for changes
id: git-check
run: |
git diff --exit-code || echo "Форматирование успешно выполнено"
if [ $? -eq 0 ]; then
echo "changes=false" >> $GITHUB_ENV
else
echo "changes=true" >> $GITHUB_ENV
fi
- name: Show git diff
if: env.changes == 'true'
run: git diff
- name: Commit changes
if: env.changes == 'true'
run: |
git config --local user.email "teanus.ti@gmail.com"
git config --local user.name "teanus"
git commit -am "Автоматическое форматирование кода с помощью Black"
git push