Bump reverse_markdown from 2.1.1 to 3.0.0 #806
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
# GitHub Actions Virtual Environments | |
# https://github.com/actions/virtual-environments/ | |
name: Optimize Images | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize, edited] | |
jobs: | |
detect-files: | |
name: Find Added Images | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.DANGER_GITHUB_API_TOKEN }} | |
fetch-depth: 0 | |
# https://github.com/marketplace/actions/changed-files | |
- name: get changed files | |
id: changed-files | |
uses: tj-actions/[email protected] | |
- name: list all changed files | |
run: | | |
echo "Found modified files:" | |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
echo "$file" | |
done | |
- name: get all images | |
id: changed-images | |
uses: tj-actions/[email protected] | |
with: | |
path: img | |
outputs: | |
images_found: ${{ steps.changed-images.outputs.added_files }} | |
optimize-images: | |
name: Optimize Added Images | |
needs: detect-files | |
if: ${{ needs.detect-files.outputs.images_found }} | |
runs-on: macOS-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.DANGER_GITHUB_API_TOKEN }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: env status | |
run: | | |
echo "Images Found: ${{ needs.detect-files.outputs.images_found }}" | |
- name: install ImageOptim | |
run: | | |
curl https://imageoptim.com/ImageOptim.tbz2 > ImageOptim.tbz2 | |
bzip2 -dc ImageOptim.tbz2 | tar xvf - | |
- name: run ImageOptim | |
run: ImageOptim.app/Contents/MacOS/ImageOptim ${{ needs.detect-files.outputs.images_found }} | |
- name: commit changes | |
run: | | |
git config --global user.email "${GITHUB_ACTOR}" | |
git config --global user.name "${GITHUB_ACTOR}@users.noreply.github.com" | |
git status | |
git pull | |
git add img/ | |
git commit -m "[automated] optimze images" || true | |
git push |