-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI Check for spotless style guidelines
Signed-off-by: Alfredo Gutierrez <[email protected]>
- Loading branch information
1 parent
ca2a4a0
commit e83cf35
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
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
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 |