Reformular e reaplicar lógica de formatação de código com o spotless #2
This file contains hidden or 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
| name: Format Code | |
| on: | |
| pull_request_review: | |
| types: [submitted] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| format: | |
| if: github.event.review.state == 'approved' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout na branch do Pull Request | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| fetch-depth: 0 | |
| - name: Instalar Java 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 25 | |
| - name: Aplicar Spotless | |
| run: ./mvnw spotless:apply | |
| - name: Commit e push se houver mudanças | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "chore: apply spotless formatting" | |
| git push | |
| else | |
| echo "Nenhuma mudança de formatação." | |
| fi |