Skip to content

Commit

Permalink
Only commit linter changes if there actually are any changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Icyadam14 committed Oct 17, 2024
1 parent 53dca8b commit df215a0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/python_linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ jobs:
- name: Run Black to format code
run: black .

- name: Commit changes
- name: Commit changes if there are any
run: |
git config --local user.name "GitHub Action"
git config --local user.email "[email protected]"
git add .
git commit -m "Auto-format code using Black"
git push
git diff --exit-code || (git add . && git commit -m "Auto-format code using Black" && git push)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use GitHub token for authentication

0 comments on commit df215a0

Please sign in to comment.