39

GitHub - calibreapp/image-actions: A Github Action that will automatically compr...

 4 years ago
source link: https://github.com/calibreapp/image-actions
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

Image actions

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

  • Compression is fast, efficient and lossless
  • Uses mozjpeg + libvips, the best image compression available
  • Runs in GitHub Actions, so it's visible to everyone

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
ignorePaths:
  - "node_modules/**"

Links and resources


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK