image-actions icon indicating copy to clipboard operation
image-actions copied to clipboard

[Feature Request] Simple markdown template

Open lfgcampos opened this issue 4 years ago • 4 comments

What problem would this feature solve?

Currently, the only output we can get from the action is the steps.calibre.outputs.markdown which uses either the pr-comment.md or the inline-pr-comment-with-diff.md. In certain cases, this template is too big to be used as an environment variables on the Actions runner causing an Error: Argument list too long error.

Describe the solution you’d like to see

I would like to see something like a pr-comment-minimal.md where you only show the comments and numbers without the big table with all the images and changes that happened. eg:

Images automagically compressed by Calibre's image-actions ✨

Compression reduced images by <%- overallPercentageSaved %>%, saving <%- overallBytesSaved %>.

<% if(unoptimisedImages.length) { -%> <%- unoptimisedImages.length %> <%- unoptimisedImages.length > 1 ? 'images' : 'image' %> did not require optimisation. <% } %>

Describe alternatives you’ve considered

Alternative is to not use the output of this action on follow up actions (like the create-pull-request one).

Additional context

N/A

lfgcampos avatar Nov 30 '21 10:11 lfgcampos

@lfgcampos Thanks for logging this. This isn't something I've personally encountered, but I can see how some changes would improve things.

We could add a simple markdown template as you've suggested, but I think I'd prefer to limit the output of the existing templates so that up to 50 images are posted to a markdown table. If there's more images than 50, the table could be omitted.

Perhaps the output could be along the lines of:

Images automagically compressed by Calibre's image-actions ✨

Compression reduced images by <%- overallPercentageSaved %>%, saving <%- overallBytesSaved %>.

<% if(optimisedImages.length < 50) { -%> <!-- table of compression summary, limited to 50 images --><% } %>

<% if(unoptimisedImages.length) { -%> <%- unoptimisedImages.length %> <%- unoptimisedImages.length > 1 ? 'images' : 'image' %> did not require optimisation. <% } %>

What do you think @lfgcampos? Would that cover your use case?

Would you be in a position to help action this change?

benschwarz avatar Dec 01 '21 03:12 benschwarz

Thanks for the quick reply @benschwarz! Sounds good to me!

Another small thing I would add would be the number of optimized images in case the table is not shown. At least we would know how many were optimized and how many wasn't.

Sure, I can try to work on this change as it looks trivial!

lfgcampos avatar Dec 01 '21 07:12 lfgcampos

PR is opened!

lfgcampos avatar Dec 01 '21 09:12 lfgcampos

Hi @benschwarz, sorry to bother you but any chance to look at the PR?

lfgcampos avatar Dec 12 '21 12:12 lfgcampos