-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (40 loc) · 1.3 KB
/
image-optimization.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: image-optimization
on:
pull_request:
paths:
- '**.jpg'
- '**.jpeg'
- '**.png'
- '**.webp'
push:
branches:
- main
paths:
- '**.jpg'
- '**.jpeg'
- '**.png'
- '**.webp'
workflow_dispatch:
schedule:
- cron: '00 23 * * 0'
jobs:
image-optimization:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Optimize images
id: images
uses: calibreapp/image-actions@main
with:
compressOnly: ${{ github.event_name != 'pull_request' }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Create pull request
if: github.event_name != 'pull_request' && steps.images.outputs.markdown != ''
uses: peter-evans/create-pull-request@v3
with:
title: Optimizes images.
branch-suffix: timestamp
commit-message: Optimizes images.
body: ${{ steps.images.outputs.markdown }}