forked from Fast-64/fast64
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
36 additions
and
32 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Black lint and suggest changes | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
black-lint-and-suggest: | ||
permissions: # needed in forks? | ||
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 | ||
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 | ||
run: | | ||
echo "Black formatting applied changes. Please format with black." | ||
exit 1 | ||
fi |