8000 Add GHA testing whether files were added and deleted in the same PR. · matplotlib/matplotlib@c8a902d · GitHub
[go: up one dir, main page]

Skip to content

Commit c8a902d

Browse files
committed
Add GHA testing whether files were added and deleted in the same PR.
1 parent 3d940e3 commit c8a902d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/clean_pr.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: PR cleanliness
2+
on: [pull_request]
3+
4+
jobs:
5+
pr_clean:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- uses: actions/checkout@v2
10+
with:
11+
fetch-depth: '0'
12+
- name: Check for added-and-deleted files
13+
run: |
14+
git fetch --quiet origin "$GITHUB_BASE_REF"
15+
base="$(git merge-base "origin/$GITHUB_BASE_REF" 'HEAD^2')"
16+
ad="$(git log "$base..HEAD^2" --pretty=tformat: --name-status --diff-filter=AD |
17+
cut --fields 2 | sort | uniq --repeated)"
18+
if [[ -n "$ad" ]]; then
19+
printf 'The following files were both added and deleted in this PR:\n%s\n' "$ad"
20+
exit 1
21+
fi
< 37FF code>22+

0 commit comments

Comments
 (0)
0