diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index 1b3c5e4..fd003b6 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -242,31 +242,38 @@ jobs: path: web-app/test-results/ retention-days: 30 - - name: Install ImageMagick + - name: Install and Configure ImageMagick if: always() - run: sudo apt-get update && sudo apt-get install -y imagemagick + run: | + sudo apt-get update && sudo apt-get install -y imagemagick - name: Process Screenshots if: always() run: | + if [ ! -d "test-results" ]; then + echo "No test-results directory found" + exit 0 + fi + mkdir -p processed-screenshots - cd web-app/test-results + touch screenshot-report.md + + cd test-results for img in *.png; do if [ -f "$img" ]; then - convert "$img" -resize 800x processed-"$img" echo "Processing screenshot for $img" - BASE64_IMG=$(base64 -w 0 processed-"$img") - echo "### ${img%.*}" >> ../../screenshot-report.md - echo "![${img%.*}](data:image/png;base64,${BASE64_IMG})" >> ../../screenshot-report.md - echo "" >> ../../screenshot-report.md + convert "$img" -resize 800x ../processed-screenshots/processed-"$img" + BASE64_IMG=$(base64 -w 0 ../processed-screenshots/processed-"$img") + echo "### ${img%.*}" >> ../screenshot-report.md + echo "![${img%.*}](data:image/png;base64,${BASE64_IMG})" >> ../screenshot-report.md + echo "" >> ../screenshot-report.md fi done - cd ../.. - name: Create PR Comment if: always() && github.event_name == 'pull_request' uses: peter-evans/create-or-update-comment@v3 with: issue-number: ${{ github.event.pull_request.number }} - body-path: screenshot-report.md + body-path: web-app/screenshot-report.md edit-mode: replace