Diff with too many lines can cause the bot to fail
The Bug
- RequestError [HttpError]: Sorry, the diff exceeded the maximum number of lines (20000):
This is odd, since the pull request in question had only 8302 added and 8257 removed lines, which is less than 20 thousand.
Presumably this is a bug in getChangedLines in index.js
Expected behaviour
- If there's too many lines in the diff, the largest label should be assigned automatically instead of failing the check.
Full error message
On https://github.com/goonstation/goonstation/pull/19491
Run pascalgn/[email protected]
RequestError [HttpError]: Sorry, the diff exceeded the maximum number of lines (20000): {"resource":"PullRequest","field":"diff","code":"too_large"}
at /home/runner/work/_actions/pascalgn/size-label-action/v0.5.0/dist/index.js:2726:21
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async main (/home/runner/work/_actions/pascalgn/size-label-action/v0.5.0/dist/index.js:70:27) {
status: 406,
response: {
url: 'https://api.github.com/repos/goonstation/goonstation/pulls/19491',
status: 406,
headers: {
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
connection: 'close',
'content-length': '243',
'content-security-policy': "default-src 'none'",
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 13 Jun 2024 14:12:10 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
vary: 'Accept-Encoding, Accept, X-Requested-With',
'x-accepted-github-permissions': 'pull_requests=read; contents=read',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-api-version-selected': '2022-11-28',
'x-github-media-type': 'github.v3; param=diff',
'x-github-request-id': '1441:29D75D:71715D:D083B1:666AFE3A',
'x-ratelimit-limit': '5000',
'x-ratelimit-remaining': '4999',
'x-ratelimit-reset': '1718291530',
'x-ratelimit-resource': 'core',
'x-ratelimit-used': '1',
'x-xss-protection': '0'
},
data: {
message: 'Sorry, the diff exceeded the maximum number of lines (20000)',
errors: [Array],
documentation_url: 'https://docs.github.com/rest/pulls/pulls#get-a-pull-request',
status: '406'
}
},
request: {
method: 'GET',
url: 'https://api.github.com/repos/goonstation/goonstation/pulls/19491',
headers: {
accept: 'application/vnd.github.v3.diff',
'user-agent': 'pascalgn/size-label-action octokit-rest.js/19.0.11 octokit-core.js/4.2.1 Node.js/16.20.2 (linux; x64)',
authorization: 'token [REDACTED]'
},
request: { hook: [Function: bound bound register] }
}
}
Having this issue as well on the latest version 0.5.2
RequestError [HttpError]: Sorry, the diff exceeded the maximum number of lines (20000): {"resource":"PullRequest","field":"diff","code":"too_large"}
at /home/runner/work/_actions/pascalgn/size-label-action/v0.5.2/dist/index.js:2733:21
We also encountered this
data: {
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: [Array],
documentation_url: 'https://docs.github.com/rest/pulls/pulls#list-pull-requests-files',
status: '406'
}
}
Ditto, I wonder if it's a new Github API restriction, thinking that I never got this message until... some weeks ago?
data: {
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: [Array],
documentation_url: 'https://docs.github.com/rest/pulls/pulls#list-pull-requests-files',
status: '406'
}
~In any case, the mentioned docs says the limit is 3000 files, so no idea why this is happening.~ NVM, those are the docs for a possible solution for the problem, so most likely this action needs an update and start using that endpoint instead?
I think this is fixed now. However, feel free to reopen this or create a new issue if you disagree or if there are any other problems! 👍