Skip to content

Optimize images

Optimize images #16

# Compress images on demand (workflow_dispatch), and at 11pm every Sunday (schedule).
# Open a pull request if any images can be compressed
name: Optimize images
on:
workflow_dispatch:
schedule:
- cron: '00 23 * * 0'
jobs:
optimize-images:
name: Optimize images
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Resize images
uses: xprilion/img-resizer-inplace@v1
with:
target: ducks
dimensions: 300x300
- name: Compress Images
id: calibre
uses: calibreapp/image-actions@1.1.0
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
compressOnly: true
pngQuality: '95'
- name: Create New Pull Request If Needed
uses: peter-evans/create-pull-request@v7
with:
title: '🍱 Auto optimize images'
branch-suffix: timestamp
commit-message: '🍱 Auto optimize images'
body: ${{ steps.calibre.outputs.markdown }}