Skip to content

Commit 40fc066

Browse files
authored
fix(ci): Reject only added or modified png/jpg images (#610)
* fix(ci): Reject only added or modified png/jpg images * fix(ci): Fix link in workflow
1 parent 0cf5109 commit 40fc066

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/pr-reject-png-jpg.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515

1616
- name: Check for JPEG and PNG files
1717
run: |
18-
# Check for .jpeg, .jpg, .JPG, .JPEG, .png, .PNG files
19-
IMAGE_FILES=$(git diff --name-only origin/main...HEAD | (grep -iE '\.(jpe?g|png)$' || true) )
18+
# Check for .jpeg, .jpg, .JPG, .JPEG, .png, .PNG files (only added/modified, not deleted)
19+
IMAGE_FILES=$(git diff --name-only --diff-filter=AM origin/main...HEAD | (grep -iE '\.(jpe?g|png)$' || true) )
2020
2121
if [ -n "$IMAGE_FILES" ]; then
2222
echo "Rejecting merge. PR contains the following JPEG or PNG files:"
2323
echo "$IMAGE_FILES"
2424
echo "Please convert these files to WebP format. For details, see"
25-
echo "https://developer.espressif.com/pages/contribution-guide/writing-content/#use-webp-for-raster-images."
25+
echo "https://developer.espressif.com/pages/contribution-guide/writing-content/#use-webp-for-raster-images"
2626
exit 1
2727
2828
else

0 commit comments

Comments
 (0)