-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (30 loc) · 1.52 KB
/
style.yml
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
38
39
40
# Example workflow
name: Format
on:
push:
jobs:
formatting:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2 # v2 minimum required
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '16'
- name: Setup google-java-format
run: wget https://github.com/google/google-java-format/releases/download/v1.10.0/google-java-format-1.10.0-all-deps.jar
- name: Format code
run: java --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -jar google-java-format-1.10.0-all-deps.jar --set-exit-if-changed -a -r $(find . -type f -name "*.java")
continue-on-error: true
- name: Commit formatted code
uses: EndBug/add-and-commit@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
add: 'src/'
author_name: ${{ github.event.pusher.name }}
author_email: ${{ github.event.pusher.email }}
message: 'Apply fixes from CI
Co-authored-by: github-actions[bot] <action@github.com>'