Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] GitHub api request fails when PR diff is > 300 files #1489

Open
ilynehan opened this issue May 6, 2024 · 2 comments
Open

[bug] GitHub api request fails when PR diff is > 300 files #1489

ilynehan opened this issue May 6, 2024 · 2 comments

Comments

@ilynehan
Copy link

ilynehan commented May 6, 2024

Report

What did you do?

We are running a custom danger file on PR diff:

bundle exec danger --dangerfile=danger/DangerCheckDiff.rb --danger_id=check_diff --fail-on-errors=true

We have started to see failures on CI within the last month or so when running this for PRs that have more than 300 files diff.

Here's the error log:

GET https://api.github.com/repos/procore/android/pulls/18757: 406 - Sorry, the diff exceeded the maximum number of files (300). Consider using 'List pull requests files' API or locally cloning the repository instead. (Octokit::NotAcceptable)
Error summary:
  resource: PullRequest
  field: diff
  code: too_large // See: https://docs.github.com/rest/pulls/pulls#list-pull-requests-files

What did you expect to happen?

Danger runs successfully on PRs with diff of over 300 files.

What happened instead?

Danger fails with error (see above)

Your Environment

  • Which CI are you running on? - CircleCI

  • Are you running the latest version of Danger? - Yes, we are on danger 9.4.3

  • What is your Dangerfile?

    # we are checking all our modified & added files
    (git.modified_files + git.added_files).each do |file|
      ...
@orta
Copy link
Member

orta commented May 7, 2024

This is how we solved it in danger js, for anyone interested in making a PR: danger/danger-js#1440

@technicalpickles
Copy link

Did some poking around to see where this change would need to be, and think I narrowed it down to here:

def pr_diff
@pr_diff ||= client.pull_request(ci_source.repo_slug, ci_source.pull_request_id, accept: "application/vnd.github.v3.diff")
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants