forked from Fast-64/fast64
-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (31 loc) · 1 KB
/
black.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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