danger / danger-js

⚠️ Stop saying "you forgot to …" in code review
http://danger.systems/js/
MIT License
5.26k stars 368 forks source link

GitHub: use files API with pagination #1440

Closed fabianehlert closed 5 months ago

fabianehlert commented 5 months ago

Switched from using the GitHub API Get a pull request to the List pull requests files API, incorporating pagination to retrieve pull request diffs. This change enables the analysis of pull requests containing more than 300 files.

Although the 300 file limit on the "Get a pull request" API isn't new, GitHub recently began enforcing it with a HTTP 406 status code. Currently, Danger is failing when analyzing pull requests exceeding this limit.

The "List pull requests files" API returns a slightly different git diff format, omitting the initial diff --git … part which parse-diff expects. As a hack, I'm adding it manually now.

Happy to hear your feedback on this approach :)

Fixes https://github.com/danger/danger-js/issues/1432 and https://github.com/danger/swift/issues/606

orta commented 5 months ago

This seems reasonable to me 👍🏻