Open doriandekoning opened 2 months ago
Thank you for your feedback! This feedback makes sense.
I think we can change wrapCode function if tfcmt writes the result to a local file.
https://github.com/suzuki-shunsuke/tfcmt/blob/898a491a6a98617f945bfe0c8f545bb7f5eda49f/pkg/notifier/localfile/plan.go#L55 https://github.com/suzuki-shunsuke/tfcmt/blob/898a491a6a98617f945bfe0c8f545bb7f5eda49f/pkg/terraform/template.go#L170
Thank you for your feedback! This feedback makes sense.
I think we can change wrapCode function if tfcmt writes the result to a local file.
Hmm, this depends on how to use a local file.
If users edit the file and post it to GitHub, wrapCode
should trancate long result.
IIRC, I heard some people use --output
option to put together multiple results to one comment.
So as you said, maybe an option to switch behaviour is necessary. 🤔
Awesome, thanks for the quick reply!
If other people put together multiple results in one comment I think they might need to do truncation anyway in case the individual files do not exceed the limit but the combined one does? In that case an option would not help much (but that would be the case with the current implementation and with the one in the PR)
Thanks for picking this up, are there any updates on this? Anything I can still help out with?
With the wrapCode
, is that i need to produce the output file without the wrapCode
first, check the size of the output and then produce output again with-or-without (if-else) wrapCode
based on the output size so that it will fit into my specific limit?
Feature Overview
Currently the wrapCode function truncates the contents to the github comment size limit, even when writing the output to a local file. Files have no size limit of course so it would be great if it (optionally configurable) would not truncate when writing to a file.
An approach would be to just add a boolean parameter to wrapCode,
truncate
to indicate if truncation should take place, this can be passed as true when using the github notifier but false when using the localfile notifier, implementation would be fairly trivial. However, this would not be backwards compitable with people who have written their own templates with the wrapCode function as they would need to add the truncate param. I'm not sure of another elegant way to implement its.If welcomed I'd like to create a PR to solve this!
Why is the feature needed?
We use writing to a local file to get around the github comment size limit but it now is still truncated
Example Code
No response
note
No response