Skip to content

Merge pull request #2 from suzuki-2001/dev #6

Merge pull request #2 from suzuki-2001/dev

Merge pull request #2 from suzuki-2001/dev #6

Workflow file for this run

name: Format Code
on:
push:
paths:
- '**.py'
- 'pyproject.toml'
- '.github/workflows/black-format.yml'
jobs:
format:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install formatters
run: |
python -m pip install --upgrade pip
pip install black isort
- name: Create pyproject.toml
run: |
cat << EOF > pyproject.toml
[tool.black]
line-length = 120
target-version = ['py310']
include = '\.pyi?$'
[tool.isort]
profile = "black"
line_length = 120
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
EOF
- name: Format code
run: |
isort .
black .
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: format code with Black and isort"
commit_user_name: "github-actions[bot]"
commit_user_email: "github-actions[bot]@users.noreply.github.com"
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"