-
-
Notifications
You must be signed in to change notification settings - Fork 776
58 lines (49 loc) · 1.96 KB
/
Copy pathimage-actions.yml
File metadata and controls
58 lines (49 loc) · 1.96 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: "Compress images"
on:
pull_request: # PRs with image (but we can't push changes back to other forks)
paths:
- "**.jpg"
- "**.jpeg"
- "**.png"
- "**.webp"
- "**.avif"
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
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions: {}
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"
permissions:
contents: "read"
steps:
- name: "Checkout Repo"
uses: "actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0" # v7.0.0
with:
persist-credentials: false
- name: "Compress Images"
id: "compress_images"
uses: "calibreapp/image-actions@9d037c06280028c110ff61c433ad4dc7d33c3c43" # 1.5.0
with:
GITHUB_TOKEN: ${{ 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@5f6978faf089d4d20b00c7766989d076bb2fc7f1" # v8.1.1
with:
title: "Auto Compress Images"
branch-suffix: "timestamp"
commit-message: "Compress Images"
body: ${{ steps.compress_images.outputs.markdown }}