chore/#45 -> staging merge commit #72
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: Code Quality Check | |
| on: | |
| pull_request: | |
| paths: | |
| - 'src/**/*.kt' | |
| - 'build.gradle.kts' | |
| - '.github/workflows/code-quality.yml' | |
| push: | |
| branches: | |
| - main | |
| - staging | |
| jobs: | |
| spotless-check: | |
| name: Code Format Check (Spotless) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| cache: 'gradle' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Run Spotless Check | |
| id: spotless | |
| run: ./gradlew spotlessCheck --no-daemon | |
| continue-on-error: true | |
| - name: Comment PR with Spotless Results | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const outcome = '${{ steps.spotless.outcome }}'; | |
| const icon = outcome === 'success' ? '✅' : '❌'; | |
| const status = outcome === 'success' ? 'PASSED' : 'FAILED'; | |
| const output = `#### Code Format Check ${icon} \`${status}\` | |
| **Spotless Check**: \`${{ steps.spotless.outcome }}\` | |
| ${outcome === 'failure' ? ` | |
| ⚠️ **Code formatting issues detected!** | |
| Please run the following command to fix formatting issues: | |
| \`\`\`bash | |
| ./gradlew spotlessApply | |
| \`\`\` | |
| Then commit the changes and push again. | |
| ` : '✨ All code formatting checks passed!'} | |
| --- | |
| *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: output | |
| }); | |
| - name: Spotless Check Status | |
| if: steps.spotless.outcome == 'failure' | |
| run: | | |
| echo "❌ Spotless check failed!" | |
| echo "Please run './gradlew spotlessApply' to fix formatting issues." | |
| exit 1 | |
| - name: Success Message | |
| if: steps.spotless.outcome == 'success' | |
| run: echo "✅ All code formatting checks passed!" |