forked from dnnsoftware/Dnn.Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (40 loc) · 1.54 KB
/
image-actions.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
41
42
name: Compress images
on:
pull_request: # PRs with image (but we can't push changes back to other forks)
paths:
- "**.jpg"
- "**.jpeg"
- "**.png"
- "**.webp"
push:
branches:
- development # merging PRs from other forks (will open a new PR)
workflow_dispatch: # on demand
schedule:
- cron: "0 0 * * 0" # every Sunday at midnight
jobs:
build:
if: | # Only run on main repo on and PRs that match the main repo.
github.repository == 'dnnsoftware/Dnn.Platform' &&
(github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository)
name: calibreapp/image-actions
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Compress Images
id: compress_images
uses: calibreapp/[email protected]
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
compressOnly: ${{ github.event_name != 'pull_request' }} # For non-Pull Requests, run in compressOnly mode and we'll PR after.
- name: Create Pull Request
if: | # If it's not a Pull Request then commit any changes as a new PR.
github.event_name != 'pull_request' && steps.compress_images.outputs.markdown != ''
uses: peter-evans/create-pull-request@v7
with:
title: Auto Compress Images
branch-suffix: timestamp
commit-message: Compress Images
body: ${{ steps.compress_images.outputs.markdown }}