Skip to content

Commit a23bac9

Browse files
support google java style
1 parent 0f6e15d commit a23bac9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/checkstyle.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Code Formatter
2+
3+
on: [push]
4+
5+
jobs:
6+
format:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: actions/setup-python@v2
11+
- name: Set up JDK 12
12+
uses: actions/setup-java@v1
13+
with:
14+
java-version: 12
15+
- run: wget https://github.com/google/google-java-format/releases/download/google-java-format-1.9/google-java-format-1.9-all-deps.jar -O formatter.jar
16+
- run: java -jar formatter.jar --replace --set-exit-if-changed $(find . -type f -name "*.java")
17+
- name: Commit Format changes
18+
if: failure()
19+
run: |
20+
git config --global user.name github-actions
21+
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
22+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
23+
git commit -am "Formatted with Google Java Formatter"
24+
git push --force origin HEAD:$GITHUB_REF

0 commit comments

Comments
 (0)