Skip to content

Commit ec50d04

Browse files
committed
Check for added-and-modified images in a given PR.
1 parent 95463c3 commit ec50d04

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/workflows/clean_pr.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,14 @@ jobs:
1919
printf 'The following files were both added and deleted in this PR:\n%s\n' "$ad"
2020
exit 1
2121
fi
22-
22+
- name: Check for added-and-modified images
23+
run: |
24+
git fetch --quiet origin "$GITHUB_BASE_REF"
25+
base="$(git merge-base "origin/$GITHUB_BASE_REF" 'HEAD^2')"
26+
am="$(git log "$base..HEAD^2" --pretty=tformat: --name-status --diff-filter=AM |
27+
cut --fields 2 | sort | uniq --repeated |
28+
grep -E '.(png|pdf|ps|eps|svg)')"
29+
if [[ -n "$am" ]]; then
30+
printf 'The following images were both added and modified in this PR:\n%s\n' "$am"
31+
exit 1
32+
fi

0 commit comments

Comments
 (0)