From 0c892cf56f5c762ff56e5a97b3fd28959f043953 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Wed, 23 Aug 2023 22:49:44 +0200 Subject: [PATCH] Leave comments on PRs with fixes for lint errors (#3224) Runs `ktlintFormat`, and adds comments to the PR if that generates any diffs. The comments include the fix, which can be accepted immediately through the GitHub UI. --- .github/workflows/ktlint.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/ktlint.yml diff --git a/.github/workflows/ktlint.yml b/.github/workflows/ktlint.yml new file mode 100644 index 000000000..c7c0e4241 --- /dev/null +++ b/.github/workflows/ktlint.yml @@ -0,0 +1,35 @@ +name: reviewdog-suggester +on: pull_request +jobs: + ktlint: + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: '17' + cache: 'gradle' + + - run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties + + - uses: gradle/wrapper-validation-action@v1 + + - uses: gradle/gradle-build-action@v2 + with: + cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }} + + - run: chmod +x ./gradlew + + - run: ./gradlew ktlintFormat + + - uses: reviewdog/action-suggester@v1 + with: + tool_name: ktlintFormat + +permissions: + contents: read + issues: write + pull-requests: write