Handling too long comment #986
-
Overviewgithub-comment currently manages excessively long comments by silently replacing them with the BodyForTooLong variable. This approach can cause confusion, especially when an empty comment is posted. I've also noticed that the maximum comment length set within github-comment differs from the limit established by the GitHub API. So, I have several proposals
In relation to the second proposal, I've found this pull request: 1bbb5e1, which made changes to use the hard coded comment length limit instead of relying on the API's error handling. Thank you for providing such a useful tool! Why is the proposal needed?By this proposal, developer can debugging github-comment more easily Reference |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Thank you for your proposal. github-comment has two features for too long comments.
I'm sorry but maybe the option
Yeah, this is a good suggestion. Let's add the warning.
This is the feature of BodyForTooLong, right?
Maybe the condition github-comment/pkg/github/comment.go Line 83 in 1516148 |
Beta Was this translation helpful? Give feedback.
-
Yes, this suggestion is for the feature So another option is update the My suggestion is to use the following part, which handling errors of GitHub API. github-comment/pkg/comment/comment.go Lines 110 to 121 in 86550fe As you know, there are some pros and cons between updating the value and handling API error. pros of handling error
cons of handling error
Which approach appears to be more effective? |
Beta Was this translation helpful? Give feedback.
You referred to the package
pkg/comment
, but this package was removed at v4.5.0.At v4.5.0, how to handle too long comment was changed.
github-comment v4.5.0 and below posted a comment with a normal template first, and if it failed to post a comment github-comment posted a comment with
BodyForTooLong
.I think this is what you suggested.
On the other hand, github-comment v4.5.0 and above checks the length of a normal template first, and if the comment is longer than threshold
65536
, github-comment posts a comment withBodyForTooLong
.The advantage of the latter is to decrease the useless API call.
But if the validation is incorrect, I t…