Skip to content

Commit e2b21a5

Browse files
authored
fixing actions
1 parent f4de3ea commit e2b21a5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/workflows/black.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ jobs:
3232
run: |
3333
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
3434
git config --local user.name "${{ github.actor }}"
35-
git diff-index --quiet HEAD || git stash -u
36-
black $(git ls-files '*.py')
37-
git stash drop
38-
git add .
39-
message="$(git log -1 --pretty=%B) Format Python code with Black"
40-
git diff-index --quiet HEAD || git commit -m "$message"
35+
if [ "$(git ls-files --modified '*.py' | wc -l)" -ne 0 ]; then
36+
git stash -u
37+
git stash drop
38+
git add .
39+
message="$(git log -1 --pretty=%B) Format Python code with Black"
40+
git commit -m "$message"
41+
fi
4142
- name: Push changes
4243
run: |
4344
git push origin master

0 commit comments

Comments
 (0)