fix workflows #268
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Форматировщик кода | |
on: | |
push: | |
branches: | |
- dev/PolGen-Lite | |
jobs: | |
push_format: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Проверка кода | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref_name }} | |
- name: Настройка Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Установка Black | |
run: pip install black | |
- name: Запуск Black | |
run: black . | |
- name: Проверка наличия изменений | |
id: changes | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "::set-output name=has_changes::true" | |
else | |
echo "::set-output name=has_changes::false" | |
fi | |
- name: Фиксация изменений | |
if: steps.changes.outputs.has_changes == 'true' | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add --all | |
git commit -m "Автоматическое форматирование кода с помощью black" | |
- name: Создание Pull Request | |
if: steps.changes.outputs.has_changes == 'true' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
delete-branch: true | |
body: "Автоматическое форматирование кода с помощью black" | |
title: "Автоматическое форматирование кода" | |
commit-message: "Автоматическое форматирование кода с помощью black" | |
branch: formatter/PolGen-Lite |