From f3d2d807239fd9b6760c1627580db868ed533559 Mon Sep 17 00:00:00 2001 From: Rajendra Reddy Date: Tue, 14 Apr 2026 12:56:56 +0000 Subject: [PATCH] Update .gitea/workflows/compressimage.yml (#14) Reviewed-on: http://git.wdipl.com/KLC/KLC-Hr-Dashboard-Frontend/pulls/14 --- .gitea/workflows/compressimage.yml | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/compressimage.yml b/.gitea/workflows/compressimage.yml index ca10571..f927196 100644 --- a/.gitea/workflows/compressimage.yml +++ b/.gitea/workflows/compressimage.yml @@ -23,11 +23,9 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - - - name: Debug Event - run: | - echo "Base: ${{ gitea.base_ref }}" - echo "Head: ${{ gitea.head_ref }}" + with: + fetch-depth: 0 + ref: ${{ gitea.head_ref }} # IMPORTANT - name: Install Image Tools run: | @@ -47,4 +45,23 @@ jobs: - name: Optimize PNG run: | find . -type f -iname "*.png" \ - -exec pngquant --force --ext .png --quality=75-90 {} \; \ No newline at end of file + -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 }} \ No newline at end of file