Fix all ruff linter errors and format with ruff #41
This file contains hidden or 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: Black | |
on: [push, pull_request] | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install Black | |
run: pip install black | |
- name: Run Black | |
id: black | |
continue-on-error: true | |
run: | | |
black --check bbox_visualizer tests | |
echo "has_changes=$?" >> $GITHUB_OUTPUT | |
- name: Format with Black if needed | |
if: steps.black.outputs.has_changes == '1' | |
run: black bbox_visualizer tests | |
- name: Create Pull Request | |
if: steps.black.outputs.has_changes == '1' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: "style: format code with Black" | |
title: "style: format code with Black" | |
body: | | |
Auto-formatted code with Black. | |
This PR was automatically created by the Black formatting GitHub Action. | |
branch: format-code-with-black | |
base: main | |
delete-branch: true | |
token: ${{ secrets.GITHUB_TOKEN }} |