Merge branch 'dev' of https://github.com/fboundy/pv_opt into dev #3
Workflow file for this run
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: Auto-format with Black | |
on: | |
push: | |
branches: | |
- main # Specify branches to run on (e.g., `main`) | |
- patch | |
- dev | |
pull_request: | |
branches: | |
- main # Automatically format PRs targeting `main` | |
- patch | |
- dev | |
jobs: | |
autoformat: | |
name: Auto-format Code with Black | |
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: | | |
python -m pip install --upgrade pip | |
pip install black | |
- name: Run Black Formatter | |
run: black --line-length 119 . | |
- name: Check for Changes | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
if [ -n "$(git status --porcelain)" ]; then | |
git add . | |
git commit -m "Automatically formatted code with Black (line-length=119)" | |
git push | |
else | |
echo "No changes to commit." |