PR webhook for image compression #6186
Description
I was chatting about this with @petele in the context of checking in a few images as part of #6183, and I wanted to transfer that discussion to a formal issue for a) additional feedback and b) making sure I wouldn't be reinventing the wheel.
I was thinking of creating a new webhook that was triggered as part of PR requests, and which will scan the list of updated files for any images. When it finds an image, it will use a [recommended tool] like imagemin
to compress the image with a reasonable default quality, and compare the compressed size to the size of the image in the PR. If the delta is greater than some percentage- or bytes-based threshold, it will fail the PR check. We can then link to the compressed version of the image in a auto-generated PR comment, which folks could download and include in a follow-up commit.
That seems to offer a reasonable balance between automating some of the tasks, without trying to do too much magic without any overrides.
CC: @addyosmani and @PaulKinlan for any thoughts.