-
Notifications
You must be signed in to change notification settings - Fork 53
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
error: body is too long (maximum is 65536 characters) #93
Comments
It seems that this 65536 chars is a hard limit https://github.com/orgs/community/discussions/41331 on the gh api one very interesting this is that this is actually misleading, if you see the following run in the same repo of mine, i am able to pass a 200 KB txt file inside which is higher than 65536 chars (~65 KB) LinksScreenshot |
We can probably have a function like below to splits the comment into multiple comments based on example of The return value of this can be used to make multiple calls to the function SplitComment(comment, maxSize, sepEnd, sepStart) {
if (comment.length <= maxSize) {
return [comment];
}
const maxWithSep = maxSize - sepEnd.length - sepStart.length;
const comments = [];
const numComments = Math.ceil(comment.length / maxWithSep);
for (let i = 0; i < numComments; i++) {
const start = i * maxWithSep;
const end = Math.min(comment.length, (i + 1) * maxWithSep);
let portion = comment.substring(start, end);
if (i < numComments - 1) {
portion += sepEnd;
}
if (i > 0) {
portion = sepStart + portion;
}
comments.push(portion);
}
return comments;
} |
Interesting issue. I intend to address this by checking the message size and breaking the message into parts if we hit the limit. I'll make this behavior optional, the default will be to truncate the message with |
hey @mshick, have you made any progress on that? Happy to help if you don't have the bandwidth. |
trim message when exceeds maximum characters
Oops, this looks misleading due to me merging a PR on a fork I made to check the tests would pass. |
Problem
If pr comments are long, github API throws body is too long (maximum is 65536 characters) error
Reproducible example file below, note that i am using the newly added
message-path
parameter to send the PR comment as a file.Run Link: https://github.com/kishaningithub/github-actions-expermiments/actions/runs/4860867805/jobs/8665212807?pr=1
workflow file: https://github.com/kishaningithub/github-actions-expermiments/actions/runs/4860867805/workflow?pr=1
Use case
The text was updated successfully, but these errors were encountered: