diff --git a/.github/workflows/spotless.yml b/.github/workflows/spotless.yml new file mode 100644 index 0000000..4efec42 --- /dev/null +++ b/.github/workflows/spotless.yml @@ -0,0 +1,44 @@ +name: Spotless + +on: + push: + branches-ignore: + - master + +permissions: + contents: write + +concurrency: + group: spotless-${{ github.ref }} + cancel-in-progress: true + +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref_name }} + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "25" + + - uses: gradle/actions/setup-gradle@v4 + + - name: Apply Spotless + run: ./gradlew spotlessApply --no-daemon + + - name: Commit formatting changes + run: | + if git diff --quiet; then + echo "Nothing to format." + exit 0 + fi + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add -u + git commit -m "chore(style): spotlessApply" + git push \ No newline at end of file