Skip to content

truncate thread comment to max size allowed #90

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

Closed
wants to merge 1 commit into from

Conversation

2bndy5
Copy link
Contributor

@2bndy5 2bndy5 commented Mar 14, 2024

resolves #89

This should avoid the error observed in #89.

A secondary problem

The thread-comments text is the same string used in step-summary text. But step-summary is not limited to a certain number of characters because it is written to a file. Therefore, if I truncate the comment's text when it is created in make_comment(), then the step-summary text will show the same lack of data, even though it isn't limited to 65535 characters.

As an alternative, I've chosen to just truncate the payload["body"] when posting a thread-comment using the REST API call. However, thread-comments may become malformed markdown syntax if they are longer than 65535 characters.
For example:

A very long comment body that exceeds 65535 characters in the next line.

</details>

could become malformed like so

A very long comment body that exceeds 65535 characters in the next line.

</det

@2bndy5 2bndy5 added the bug Something isn't working label Mar 14, 2024
Copy link

codecov bot commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (e33a5e6) to head (074574f).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #90   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        20           
  Lines         1392      1392           
=========================================
  Hits          1392      1392           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shenxianpeng
Copy link
Contributor

I've chosen to just truncate the payload["body"] when posting a thread-comment using the REST API call.

It makes sense.

However, thread-comments may become malformed markdown syntax if they are longer than 65535 characters.

Can this be solved by truncating characters less than 65535?

@2bndy5
Copy link
Contributor Author

2bndy5 commented Mar 15, 2024

However, thread-comments may become malformed markdown syntax if they are longer than 65535 characters.

Can this be solved by truncating characters less than 65535?

Thread-comments may become malformed because I'm truncating text to only 65535 characters.

It would be solved by making the comment twice, once for step-summary (with no length limit) and once for thread-comments (with length limit). But the API isn't currently designed to call make_comment() twice (which can be costly for large sets of files). Truncating the text is just easier/quicker for now. And implementing a length limit isn't a simple patch to make_comment().

@2bndy5
Copy link
Contributor Author

2bndy5 commented Mar 15, 2024

superceded by #91

@2bndy5 2bndy5 closed this Mar 15, 2024
@2bndy5 2bndy5 deleted the respect-comment-max-size branch March 15, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Github API post comment error: body is too long
2 participants