ScaCap / action-ktlint

Run Ktlint with reviewdog
Apache License 2.0
84 stars 29 forks source link

Ktlint job fails on PRs with > 300 files. #52

Closed rohan-sca closed 6 months ago

rohan-sca commented 7 months ago

About 2 months ago we updated to use ktlint version 1.1.1 Since last 2 weeks we've had a few cases with PRs having >300 files. action-ktlint fails on these PRs with the following error excerpt.

2024-04-11T13:09:41.4432546Z ktlint version: 1.1.1
2024-04-11T13:13:25.4815816Z reviewdog: post failed for ktlint: fail to parse diff: GET https://api.github.com/repos/Org/my-repo/pulls/123: 406 Sorry, the diff exceeded the maximum number of files (300). Consider using 'List pull requests files' API or locally cloning the repository instead. [{Resource:PullRequest Field:diff Code:too_large Message:}]

Not sure if this is failing now due to v1.1.1 or some new Github API changes.

ghaiszaher commented 7 months ago

Related: https://github.com/reviewdog/reviewdog/issues/1696

Seems like this is fixed with https://github.com/reviewdog/reviewdog/pull/1714

I'll try to upgrade to https://github.com/reviewdog/reviewdog/releases/tag/v0.17.4

ghaiszaher commented 7 months ago

@rohan-sca @sergiomr88 please let me know if you still face this issue.

rohan-sca commented 7 months ago

Thanks @ghaiszaher we'll keep an eye out.

ghaiszaher commented 7 months ago

Based on this comment https://github.com/reviewdog/reviewdog/issues/1696#issuecomment-2077370044, it looks like the current solution is to pass the argument reporter: github-pr-review.

Example:

      - name: ktlint
        uses: ScaCap/action-ktlint@master
        with:
          github_token: ${{ secrets.github_token }}
          reporter: github-pr-review
rohan-sca commented 6 months ago

Do please keep an eye on updates from reviewDog though, currently we're forced to use reporter: github-pr-review which can lead to it spamming PR comments for the ktlint checks.

ghaiszaher commented 6 months ago

currently we're forced to use reporter: github-pr-review which can lead to it spamming PR comments for the ktlint checks.

@rohan-sca this can be removed now, latest reviewdog version provides a fix also for github-pr-check reporters (which is the default value)