danger-js
danger-js copied to clipboard
[BUG] GitHub API request fails for PR with > 300 files change
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:
- Make a PR with changes in > 300 files
- 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: https://github.com/danger/swift/issues/606, https://github.com/reviewdog/reviewdog/issues/1696
@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.
- 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.
- 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: https://github.com/reviewdog/reviewdog/pull/1697