Skip to content
image

GitHub Action

image-actions

1.0.0 Latest version
Use latest version
image

image-actions

Automagically compress images in your repository

Installation

Copy and paste the following snippet into your .yml file.

- name: image-actions
  uses: calibreapp/image-actions@1.0.0
Learn more about this action in calibreapp/image-actions
Choose a version

Image actions

Image actions will automatically compress jpeg, png and webp images in GitHub Pull Requests.

  • Compression is fast, efficient and near-lossless
  • Uses mozjpeg + libvips, the best image compression available
  • Runs in GitHub Actions, so it's visible to everyone
  • Configurable: Use the great defaults or change to suit your needs

Preview of image-actions pull request comment

How to add this to your repository:

  • Add the following steps to a workflow file found at: .github/workflows/calibreapp-image-actions.yml (If you don’t have one, create it.)
  • Paste in the following:
name: Compress images
on: pull_request
jobs:
  build:
    name: calibreapp/image-actions
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: calibreapp/image-actions
        uses: docker://calibreapp/github-image-actions
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The GITHUB_TOKEN secret is automatically managed by GitHub. You do not have to manually create this secret. This automatic token is scoped only to the repository that is currently running the action.

Configuration

By default, you probably don’t need to configure image-actions. However, if you’d like to ignore certain file paths, or change image compression options, read on.

Configuration can be set by adding a .github/calibre/image-actions.yml file:

jpeg:
  quality: 80
png:
  quality: 80
webp:
  quality: 80
ignorePaths:
  - "node_modules/**"

Links and resources

You can’t perform that action at this time.