Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added workflow to automatically resize large gifs #74

Merged
merged 2 commits into from
Oct 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/resize-gifs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Resize gifs

on:
pull_request:
paths:
- 'public/images/*.gif'

jobs:
resize-images:
name: resize image
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
# Ref needed to work on forked repo
ref: ${{ github.event.pull_request.head.ref }}
- name: Resize large images to 300px width
run: |
for filename in public/images/*.gif; do
width=$( identify -ping -format '%w ' $filename | cut -d " " -f 1)
if (( $width > 300 )); then
echo "GIF $filename has width $width. Resizing to 300px width"
mogrify -resize 300 $filename
else
echo "GIF $filename has width $width. Not resizing."
fi
done
- name: Add & Commit files
run: |
# only commit if files were changed
if [[ $(git diff --stat) != '' ]]; then
git config --local user.email github-actions@github.com
git config --local user.name github-actions
git add .
git commit -m "Resize large images to 300px" -a
git push
fi