-
Notifications
You must be signed in to change notification settings - Fork 67
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] Only optimized changed images #92
Comments
Hey @rachmari ! 👋
Whoa! That's … a lot 😅 The current image-actions config (found in
This config means that the action will only be run when images files have been updated… but what you're asking is slightly different in that you ONLY want to process the files that have been updated, rather than the whole set. Is that correct? |
@benschwarz hello! 👋
Yep, exactly. I added the workflow below and then added 3 new images to that branch. I expected the workflow to only process those 3 new images, but the log output appeared to be processing all of the
|
Can confirm happens to me as well. All images in the repo are getting processed. |
Agree this would be useful. And agree currently it does all files each time - that's working as intended at the moment btw, rather than a bug per se, though can understand why it's not what some would want. BTW I think this should be optional, so can have some runs use this new functionality if/when it's added (maybe "on" by default for all pull request runs?) but still have the option of doing a full run to use the original (slower) full run (e.g. a timed run could be run weekly to compress everything for example in case anything was missed). Here's how I've got the list of files for another project btw, using bash rather than JavaScript, but might be helpful as a starting off point: # If this is part of pull request then get list of files as those changed
# Uses similar logic to GitHub Super Linter (https://github.com/github/super-linter/blob/master/lib/functions/buildFileList.sh)
# First checkout main to get list of differences
git pull --quiet
git checkout main
# Then get the changes, for the files needed:
CHANGED_FILES=$(git diff --name-only "main...${COMMIT_SHA}" --diff-filter=d | egrep -i '\.jpg|\.jpeg|\.png|\.webp'
# Then back to the pull request branch
git checkout --progress --force "${COMMIT_SHA}" |
@bazzadp thanks for the script! Wonder if this could already be used with the Or, if not, maybe as an extra entry in the job Ah, and in case the PR has new commits since an optimization commit: ideally the optimization should run only on changes / additions since the last commit of the action. |
@benschwarz would you have any input for workarounds in the meantime? Or suggestions for how and where this should be implemented in the action, in case someone had time to work on a pull request for this? |
We having the exact same problem! Any news on this? |
No news from me on this, we're focused in other areas at the moment. Leaving notes for future me (or someone else) who implements this:
|
hi! curious - any updates on it? maybe some workarounds at least 🙏 |
@liss-mouse No, there are no updates. I'm sorry you feel that this project isn't useful for anything more than a hello world. I disagree. While your use case is valid, your feedback isn't overly helpful and wasn't well received. If your requirements are such that the library doesn't work for you, please consider submitting a PR to amend the behavior, or search for an alternative that meets your needs. Thanks. |
Hi @benschwarz , Is there any update on this? |
Nope! I'd post an update if there was one 😉 |
Thank you for creating this well-documented action! 🙌
Also, please forgive me if I missed any documentation or settings that would solve what I'm requesting. 😅
What problem would this feature solve?
It looks like this action will optimize all images in the repo that match any selected paths. If that is true, I'd love the ability to be able to only optimize images that are part of the commit that triggered the workflow. This would speed up a potentially long process and target only changed images.
We have a very large directory of images that takes up to 5 hours to compress, but if we know that the existing images are already compressed, it'd be great to only optimize images that are added or updated.
Describe the solution you’d like to see
An input parameter that allows you to select targeting only images that are part of the commit that triggered the workflow. This would likely only be applicable to
pull_request
andpush
events.If the input parameter is set, the action would retrieve the list of changed files and find any image files. If there are changed image files, those images will be compressed.
The text was updated successfully, but these errors were encountered: