-
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
1 parent
db863a3
commit 3042bb6
Showing
1 changed file
with
9 additions
and
10 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -14,6 +14,9 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Ensures you fetch all history for .git files | ||
token: ${{ secrets.GITHUB_TOKEN }} # Ensures the checkout action has permission to check out the code | ||
|
||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v3 | ||
|
@@ -43,18 +46,14 @@ jobs: | |
- name: Install Black | ||
run: pip install black | ||
|
||
- name: Run Black | ||
- name: Run Black and check for changes | ||
run: | | ||
cd clashstats | ||
black . | ||
black . --check --diff | ||
- name: Commit changes | ||
- name: Commit changes if any | ||
if: ${{ steps.black.outputs.has-changes == 'true' }} | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add -u | ||
git commit -m "Format Python code with Black" || echo "No changes to commit" | ||
git add -A | ||
git commit -m "Format Python code with Black" | ||
git push origin HEAD:${{ github.ref }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |