From 241e12de4b3d3fcfda3d25d46b3222b8410f5432 Mon Sep 17 00:00:00 2001 From: jpwang Date: Thu, 4 Sep 2025 19:00:31 +0800 Subject: [PATCH 1/2] Integrate reviewdog --- .github/workflows/checkstyle.yml | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/checkstyle.yml diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml new file mode 100644 index 000000000..58b8d6dab --- /dev/null +++ b/.github/workflows/checkstyle.yml @@ -0,0 +1,40 @@ +name: Checkstyle +on: + pull_request: + +permissions: + checks: write + contents: read + pull-requests: write + +jobs: + checkstyle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Run Checkstyle + run: | + ./gradlew checkstyleMain checkstyleTest + + - uses: reviewdog/action-setup@v1.4.0 + + - name: Run reviewdog + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + find . -path "*/build/reports/checkstyle/*.xml" -exec sh -c ' + for xmlReport do + cat "$xmlReport" | reviewdog -f=checkstyle -fail-level=any -reporter=github-pr-review || exit 1 + done + ' sh {} + From e43733f5fb5b4baf0ed14213674389589987824b Mon Sep 17 00:00:00 2001 From: jpwang Date: Sun, 7 Sep 2025 15:52:07 +0800 Subject: [PATCH 2/2] Update .github/workflows/checkstyle.yml Co-authored-by: Teng Zhang --- .github/workflows/checkstyle.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index 58b8d6dab..dc1362f78 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -33,8 +33,10 @@ jobs: env: REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - find . -path "*/build/reports/checkstyle/*.xml" -exec sh -c ' - for xmlReport do - cat "$xmlReport" | reviewdog -f=checkstyle -fail-level=any -reporter=github-pr-review || exit 1 - done - ' sh {} + + find . -path "*/build/reports/checkstyle/*.xml" -type f | while read -r xmlReport; do + cat "$xmlReport" | reviewdog \ + -f=checkstyle \ + -fail-level=any \ + -reporter=github-pr-review \ + || exit 1 + done