Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create black-suggest.yml #455

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
13 changes: 0 additions & 13 deletions .github/workflows/black-lint.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Black lint and suggest changes

on: [pull_request, push]

jobs:
black-lint-and-suggest:
permissions: # needed in forks? https://github.com/parkerbxyz/suggest-changes/issues/33
contents: read
pull-requests: write
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip' # caching pip dependencies
- run: pip install black==23.12.1

- name: Run black
run: black . # if this fails nothing else will run, this is correct behavior

- name: Suggest changes via comment
if: github.event_name == 'pull_request' # Only run for PRs
uses: parkerbxyz/suggest-changes@v1
with:
comment: 'Please commit the suggested changes from black.'

- name: Fail if changes were made
run: |
if git diff --quiet; then
echo "Black formatting applied no changes."
exit 0
else
echo "Black formatting applied changes. Please format with black."
exit 1
fi