Skip to content

Commit

Permalink
Add CI Check for spotless style guidelines
Browse files Browse the repository at this point in the history
Signed-off-by: Alfredo Gutierrez <[email protected]>
  • Loading branch information
AlfredoG87 committed Jul 11, 2024
1 parent ca2a4a0 commit e83cf35
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/spotless-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Spotless Check

on: [pull_request]

jobs:
spotless:
runs-on: ubuntu-latest

steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit

- name: Checkout code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Set up JDK 21
uses: actions/setup-java@d62f12622c1c8c47f24e7d3b71611062a1e56a13 # v3.13.0
with:
distribution: 'temurin'
java-version: '21'

- name: Cache Gradle packages
uses: actions/cache@b6e12325fcdfbd3b3d3e192ae02d9bcd3c9b37c5 # v2.1.8
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Spotless Check
run: ./gradlew spotlessCheck

- name: Run Spotless Apply and Check for Changes
id: check_spotless
run: |
./gradlew spotlessApply
if ! git diff --exit-code; then
echo "Spotless found formatting issues. Please run './gradlew spotlessApply' to fix them."
exit 1
fi

0 comments on commit e83cf35

Please sign in to comment.