feat(CI): Added GitHub Actions to check for code style violations #5
This file contains 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 Files | ||
on: | ||
pull_request: | ||
jobs: | ||
format: | ||
name: Check if files need formatting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Maven | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 21 | ||
distribution: zulu | ||
- name: Check if code aligns with code style | ||
id: spotless | ||
run: mvn spotless:check | ||
continue-on-error: true | ||
- name: Comment on PR | ||
if: ${{ steps.spotless.outcome == 'failure' }} | ||
run: | | ||
gh pr review ${{ github.event.number }} --body "Code does not align with code style. Please run \`mvn spotless:apply\` and commit the changes." | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |