Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Auto-format with Black

on:
push:
branches: [ master, main ]
pull_request:

jobs:
format:
if: github.actor != 'github-actions[bot]'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this exclusion here?

runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use hashes here like in the other workflow files.

with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Black
run: pip install black==25.12.0

- name: Run Black
run: black . --line-length 120 --exclude '.*_pb2.pyi?$'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reuse the CI way to run black here or does this not work? This way we don't have to worry about keeping these in sync.


- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: auto-format with black"
branch: ${{ github.head_ref }}