-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (32 loc) · 1007 Bytes
/
javaformat.yaml
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
31
32
33
34
35
36
37
name: Java Format
on: [push]
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Format with google-java-format 1.8
run: |
echo "Downloading google-java-format 1.8..."
wget -q https://github.com/google/google-java-format/releases/download/google-java-format-1.8/google-java-format-1.8-all-deps.jar
echo ""
FILES=`find . -name "*.java" -type f`
echo "Found the following Java files:"
for file in $FILES; do
echo $file
done
echo ""
EXIT=0
for file in $FILES; do
echo -e "Running google-java-format on:\n $file\n"
if ! java -jar ./google-java-format-1.8-all-deps.jar $file | diff $file -; then
EXIT=1
fi
echo ""
done
exit $EXIT
shell: bash