Skip to content

Commit dde6c6c

Browse files
jjpppzhangt2333
andauthored
Add code style violation reporting to PRs (#204)
Co-authored-by: Teng Zhang <[email protected]>
1 parent 064801b commit dde6c6c

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/checkstyle.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Checkstyle
2+
on:
3+
pull_request:
4+
5+
permissions:
6+
checks: write
7+
contents: read
8+
pull-requests: write
9+
10+
jobs:
11+
checkstyle:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
submodules: recursive
17+
18+
- uses: actions/setup-java@v4
19+
with:
20+
java-version: 17
21+
distribution: temurin
22+
23+
- name: Setup Gradle
24+
uses: gradle/actions/setup-gradle@v4
25+
26+
- name: Run Checkstyle
27+
run: |
28+
./gradlew checkstyleMain checkstyleTest
29+
30+
- uses: reviewdog/[email protected]
31+
32+
- name: Run reviewdog
33+
env:
34+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run: |
36+
find . -path "*/build/reports/checkstyle/*.xml" -type f | while read -r xmlReport; do
37+
cat "$xmlReport" | reviewdog \
38+
-f=checkstyle \
39+
-fail-level=any \
40+
-reporter=github-pr-review \
41+
|| exit 1
42+
done

0 commit comments

Comments
 (0)