@@ -23,11 +23,9 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
- name: Debug Event
|
fetch-depth: 0
|
||||||
run: |
|
ref: ${{ gitea.head_ref }} # IMPORTANT
|
||||||
echo "Base: ${{ gitea.base_ref }}"
|
|
||||||
echo "Head: ${{ gitea.head_ref }}"
|
|
||||||
|
|
||||||
- name: Install Image Tools
|
- name: Install Image Tools
|
||||||
run: |
|
run: |
|
||||||
@@ -48,3 +46,22 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
find . -type f -iname "*.png" \
|
find . -type f -iname "*.png" \
|
||||||
-exec pngquant --force --ext .png --quality=75-90 {} \;
|
-exec pngquant --force --ext .png --quality=75-90 {} \;
|
||||||
|
|
||||||
|
# Commit changes if any
|
||||||
|
- name: Commit changes
|
||||||
|
run: |
|
||||||
|
git config --global user.name "CI Bot"
|
||||||
|
git config --global user.email "ci@local"
|
||||||
|
|
||||||
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
|
git add .
|
||||||
|
git commit -m "chore: optimize images via CI"
|
||||||
|
else
|
||||||
|
echo "No changes to commit"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Push back to PR branch
|
||||||
|
- name: Push changes
|
||||||
|
if: success()
|
||||||
|
run: |
|
||||||
|
git push origin HEAD:${{ gitea.head_ref }}
|
||||||
Reference in New Issue
Block a user