Skip to content
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

[Feature Request] Simple markdown template #107

Open
lfgcampos opened this issue Nov 30, 2021 · 4 comments
Open

[Feature Request] Simple markdown template #107

lfgcampos opened this issue Nov 30, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@lfgcampos
Copy link

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 lfgcampos added the enhancement New feature or request label Nov 30, 2021
@benschwarz
Copy link
Member

@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?

@lfgcampos
Copy link
Author

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
Copy link
Author

PR is opened!

@lfgcampos
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
2 participants