File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed
Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change 1- name : Apply Spotless Formatting
1+ name : 🧼 Apply Spotless Formatting
22
33on :
4- pull_request :
5- branches :
6- - main
74 push :
8- branches :
9- - main
5+ branches : [main]
6+
7+ permissions :
8+ contents : write
109
1110jobs :
1211 format :
1312 runs-on : ubuntu-latest
1413 concurrency :
15- group : ${{ github.workflow }}-${{ github.head_ref || github. ref_name }}
14+ group : ${{ github.workflow }}-${{ github.ref_name }}
1615 cancel-in-progress : true
1716
1817 steps :
1918 - name : Checkout repository
2019 uses : actions/checkout@v4
2120 with :
22- ref : ${{ github.head_ref || github.ref_name }}
2321 fetch-depth : 0
2422
2523 - name : Set up JDK 17
@@ -32,15 +30,15 @@ jobs:
3230 - name : Apply Spotless formatting
3331 run : mvn spotless:apply
3432
35- - name : Commit changes if any
33+ - name : Commit and push formatting changes
3634 run : |
3735 git config --global user.name "github-actions[bot]"
3836 git config --global user.email "github-actions[bot]@users.noreply.github.com"
39- git add .
40- if ! git diff --quiet --staged ; then
37+ git add -A
38+ if ! git diff --cached --quiet ; then
4139 git commit -m "Apply Spotless formatting"
42- git pull --rebase origin ${{ github.head_ref || github.ref_name }}
43- git push origin HEAD:${{ github.head_ref || github. ref_name }}
40+ git pull --rebase --autostash origin ${{ github.ref_name }}
41+ git push origin HEAD:${{ github.ref_name }}
4442 else
45- echo "No formatting changes to commit."
43+ echo "✅ No formatting changes to commit."
4644 fi
You can’t perform that action at this time.
0 commit comments