action-ktlint icon indicating copy to clipboard operation
action-ktlint copied to clipboard

Ktlint job fails on PRs with > 300 files.

Open rohan-sca opened this issue 2 months ago • 4 comments

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.

rohan-sca avatar Apr 11 '24 14:04 rohan-sca

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 avatar Apr 19 '24 16:04 ghaiszaher

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

ghaiszaher avatar May 02 '24 09:05 ghaiszaher

Thanks @ghaiszaher we'll keep an eye out.

rohan-sca avatar May 02 '24 10:05 rohan-sca

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

ghaiszaher avatar May 06 '24 13:05 ghaiszaher