-
Notifications
You must be signed in to change notification settings - Fork 26
30 lines (26 loc) · 1.04 KB
/
java-format-checker.yml
File metadata and controls
30 lines (26 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: Check Java Format
on: [ push, pull_request ]
permissions:
contents: read
jobs:
formatting:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Set up JDK 17
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Code style analysis
run: |
wget https://github.com/google/google-java-format/releases/download/v1.20.0/google-java-format-1.20.0-all-deps.jar
java -jar google-java-format-1.20.0-all-deps.jar --aosp --skip-javadoc-formatting --skip-reflowing-long-strings --skip-sorting-imports --replace -i $(git ls-files|grep \.java$)
- name: Print diffs
run: git --no-pager diff --exit-code