Skip to content

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

Description

@ilynehan

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|
      ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions