8000 Check for added-and-modified images in a given PR. · matplotlib/matplotlib@98b0ab0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 98b0ab0

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

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/clean_pr.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,13 @@ 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+
git fetch --quiet origin "$GITHUB_BASE_REF"
24+
base="$(git merge-base "origin/$GITHUB_BASE_REF" 'HEAD^2')"
25+
am="$(git log "$base..HEAD^2" --pretty=tformat: --name-status --diff-filter=AM |
26+
cut --fields 2 | sort | uniq --repeated |
27+
grep -E '.(png|pdf|ps|eps|svg)')"
28+
if [[ -n "$am" ]]; then
29+
printf 'The following images were both added and modified in this PR:\n%s\n' "$ad"
30+
exit 1
31+
fi

0 commit comments

Comments
 (0)
0