Image Actions automatically compress JPEG, PNG and WebP images in GitHub Pull Requests.

.github/workflows/calibreapp-image-actions.yml file.name: Compress images
on: pull_request
jobs:
build:
name: calibreapp/image-actions
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Compress Images
uses: calibreapp/image-actions@master
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
The GITHUB_TOKEN secret is automatically generated by GitHub. This automatic token is scoped only to the repository that is currently running the action.
By default, you probably don’t need to configure image-actions.
However, if you’d like to ignore specific file paths, or change image compression options, read on.
Change the configuration options by adding arguments to the action:
- name: Compress Images
uses: calibreapp/image-actions@master
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
jpegQuality: "80"
pngQuality: "80"
webpQuality: "80"
ignorePaths: "node_modules/**,build"
# No spaces allowed
Previous versions of image-actions used .github/config/image-actions.yml for configuration.
If you're still using that configuration method we suggest that you update it.
image-actions uses by defaultjpegQuality, pngQuality and webpQuality config keys will be delivered directly into sharp’s toFormat. (JPEG options, PNG options, Webp options)ignorePaths allows for path globbing see the glob package for more detailsimage-actions is designed to run for each Pull Request. In some repositories, images are seldom updated. To run the action only when images have changed, use GitHub Action’s on.push.paths workflow configuration:
name: Compress images
on:
pull_request:
paths:
- '**.jpg'
- '**.png'
- '**.webp'
The above workflow will only run when jpg, png or webp files are changed.
Content type
Image
Digest
Size
283.8 MB
Last updated
over 6 years ago
docker pull chabad360/image-actions