Skip to content

only save added index #668

only save added index

only save added index #668

name: Code Formatter
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
format:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Black
run: pip install "black[jupyter]"
- name: Run Black
run: black . --exclude=".*\.ipynb$"
- name: Commit changes
if: github.event_name == 'pull_request'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -am "chore(format): run black" || echo "No changes to commit"
git push
- name: Create Pull Request
if: github.event_name == 'push'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore(format): run black"
title: "chore(format): run black"
body: |
This is an auto-generated PR with formatting changes from Black.
branch: format-${{ github.sha }}
delete-branch: true