Skip to content

Project Name change. #40

Project Name change.

Project Name change. #40

Workflow file for this run

name: Lint with Black & Format with isort and Push
on:
push:
branches:
- '*'
workflow_run:
workflows: ["ci-test-run.yml"]
types:
- completed
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11 # Python version
- name: Install Black
run: pip install isort black
- name: Run Black and Apply Formatting
run: |
black `git ls-files '*.py'`
isort `git ls-files '*.py'`
- name: Show changes
run: |
git --no-pager diff
- name: Show branch
run: |
git rev-parse --abbrev-ref HEAD
- name: Commit and Push Changes if Black made changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
if git diff --exit-code; then
echo "No changes made by Black, skipping commit and push."
else
git add .
git commit -m "Apply Black formatting"
git push origin `git rev-parse --abbrev-ref HEAD`
fi