test(test_resources/test_files): rename test files for better sorting… #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Optimise Images | |
# **What it does**: Automatically compress and optimise images. | |
# **Why we have it**: Reduces bandwidth needs of app and repo. | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "**.jpg" | |
- "**.jpeg" | |
- "**.png" | |
- "**.webp" | |
pull_request: | |
paths: | |
- "**.jpg" | |
- "**.jpeg" | |
- "**.png" | |
- "**.webp" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
build: | |
name: Optimise Images | |
runs-on: ubuntu-latest | |
# Only run on main repo and PRs that match the main repo | |
if: > | |
github.repository == 'Fdawgs/docsmith' && | |
(github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name == github.repository) | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Compress images | |
id: calibre | |
uses: calibreapp/image-actions@1.1.0 | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
jpegQuality: "100" | |
pngQuality: "100" | |
webpQuality: "100" | |
# For non-Pull Requests, run in compressOnly mode and PR after | |
compressOnly: ${{ github.event_name != 'pull_request' }} | |
- name: Create pull request | |
# If it is not a Pull Request then commit any changes as a new PR | |
if: > | |
github.event_name != 'pull_request' && | |
steps.calibre.outputs.markdown != '' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
title: "chore: auto-compress images" | |
branch-suffix: timestamp | |
commit-message: "chore: auto-compress images" | |
body: ${{ steps.calibre.outputs.markdown }} |