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 for PR with > 300 files change #1432

Closed
narutox900 opened this issue Apr 4, 2024 · 2 comments · Fixed by #1440
Closed

[BUG] GitHub API request fails for PR with > 300 files change #1432

narutox900 opened this issue Apr 4, 2024 · 2 comments · Fixed by #1440

Comments

@narutox900
Copy link

Describe the bug
We are using danger@^11.2.7 on CircleCI.
Since a week before, we started noticing that even though danger shows a successful execution, the detail logs show that there's an error with GitHub API. Upon reading GitHub API docs, it states that the limit is 3000 files, however the error shows that the maximum number of files is 300. I haven't been able to find any changelogs related to this problem. Logs from earlier runs on large PRs show that danger can still run properly before

To Reproduce
Steps to reproduce the behavior:

  1. Make a PR with changes in > 300 files
  2. Run danger on CI

Expected behavior

  • Returns a fail exit code if danger could not run properly.
  • Maybe find a way to workaround this new limit

Screenshots

yarn run v1.19.1
$ /home/circleci/*********/node_modules/.bin/danger ci
Request failed [406]: https://api.github.com/repos/*********/*********/pulls/11777
Response: {
  "message": "Sorry, the diff exceeded the maximum number of files (300). Consider using 'List pull requests files' API or locally cloning the repository instead.",
  "errors": [
    {
      "resource": "PullRequest",
      "field": "diff",
      "code": "too_large"
    }
  ],
  "documentation_url": "https://docs.github.com/rest/pulls/pulls#list-pull-requests-files"
}
------------------------------------

------- Check SP tracking ----------
------- Note: this can log many errors in case of renamed files, but it can still pass the build -----
------------------------------------
------------------------------------
------- Check CI CLASS REMOVED -----
------- Note: this can log many errors in case of renamed files, but it can still pass the build -----
------------------------------------
------------------------------------
------- Check Holistics docs url ---
------------------------------------


Found only warnings, not failing the build.
Feedback: https://github.com/*********/*********/pull/11777#issuecomment-2030941585
Could not add a commit status, the GitHub token for Danger does not have access rights.
If the build fails, then danger will use a failing exit code.
Done in 26.62s.

CircleCI received exit code 0

Your Environment

software version
danger.js 11.2.7
node 18.16.1
npm
Operating System Ubuntu 20.04.6 LTS

Additional context
Related issues: danger/swift#606, reviewdog/reviewdog#1696

@narutox900 narutox900 added the bug label Apr 4, 2024
@fbartho fbartho added enhancement and removed bug labels Apr 11, 2024
@fbartho
Copy link
Member

fbartho commented Apr 11, 2024

@narutox900 Do you have the fail on error flag set when calling DangerJS? — If yes, and this is still occurring, then we should enhance the core to treat this as a fatal error.

@narutox900
Copy link
Author

  1. Yes, when I tried to add the fail on error flag, the output is still the same
circleci@289ec4e24d5c:~/*******$ yarn danger ci -f
yarn run v1.19.1
$ /home/circleci/*******/node_modules/.bin/danger ci -f
Request failed [406]: https://api.github.com/repos/*******/*******/pulls/11777
Response: {
  "message": "Sorry, the diff exceeded the maximum number of files (300). Consider using 'List pull requests files' API or locally cloning the repository instead.",
  "errors": [
    {
      "resource": "PullRequest",
      "field": "diff",
      "code": "too_large"
    }
  ],
  "documentation_url": "https://docs.github.com/rest/pulls/pulls#list-pull-requests-files"
}
------------------------------------

------- Check SP tracking ----------
------- Note: this can log many errors in case of renamed files, but it can still pass the build -----

------------------------------------

------------------------------------
------- Check CI CLASS REMOVED -----

------- Note: this can log many errors in case of renamed files, but it can still pass the build -----
------------------------------------

------------------------------------
------- Check Holistics docs url ---

------------------------------------


Found only warnings, not failing the build.
Feedback: https://github.com/*******/*******/pull/11777#issuecomment-2030941585
Could not add a commit status, the GitHub token for Danger does not have access rights.
If the build fails, then danger will use a failing exit code.
Done in 21.85s.
  1. I think the main problem for me is to find a workaround for the new GitHub API limit since 300 files in a PR is not uncommon.
    Related information: Add a fallback to git diff command to get diff of a GitHub pull request  reviewdog/reviewdog#1697

@narutox900 narutox900 changed the title [BUG] GitHub API request fails silently [BUG] GitHub API request fails for PR with > 300 files change Apr 15, 2024
@orta orta closed this as completed in #1440 May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants