add Spotless workflow for automatic code formatting
This commit is contained in:
1 parent
5c39554130
commit
e45cc4a560
1 file changed
+45
@@ -0,0 +1,45 @@
|
|||||||
|
name: Spotless Code Formatting
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
spotless:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ github.token }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up JDK
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '24'
|
||||||
|
cache: 'gradle'
|
||||||
|
|
||||||
|
- name: Make gradlew executable
|
||||||
|
run: chmod +x ./gradlew
|
||||||
|
|
||||||
|
- name: Run spotlessCheck
|
||||||
|
id: spotless_check
|
||||||
|
run: ./gradlew spotlessCheck
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Run spotlessApply if check failed
|
||||||
|
if: steps.spotless_check.outcome == 'failure'
|
||||||
|
run: ./gradlew spotlessApply
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
if: steps.spotless_check.outcome == 'failure'
|
||||||
|
run: |
|
||||||
|
git config --local user.email "openmmo-bot"
|
||||||
|
git config --local user.name "openmmo-bot@forge.fiereu.de"
|
||||||
|
git add -A
|
||||||
|
git diff --staged --quiet || git commit -m "Apply spotless formatting [skip ci]"
|
||||||
|
git push
|
||||||
Reference in new issue
Block a user