Skip to content

Commit 8bfca1f

Browse files
committed
Add workflow to catch common PR mistakes
1 parent 32d5ba7 commit 8bfca1f

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/check-files.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Check PR files
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
files:
8+
name: Check files
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0 # allows diffing against base branch
14+
- name: Check for videos
15+
run: |
16+
if test $(find -name '*.mp4' -o -name '*.mov' -o -name '*.m4v' -o -name '*.mkv' -o -name '*.webm' -o -name '*.ogv' | wc -l) -gt 0; then
17+
echo "::notice title=Video file found::Videos should not be stored in the repository; please ask the WAI Team for assistance."
18+
echo "CHECK_FAILED=1" >> "$GITHUB_ENV"
19+
fi
20+
- name: Check for non-finalized Technique filenames
21+
run: |
22+
if test $(find techniques/*/* -name '*.html' | egrep -vc '/[A-Z]+[0-9]+.html$') -gt 0; then
23+
echo "::notice title=Technique with temporary filename found::New techniques should follow the naming scheme for their folder."
24+
echo "CHECK_FAILED=1" >> "$GITHUB_ENV"
25+
fi
26+
- name: Check for remaining class="instructions" paragraphs
27+
run: |
28+
if test $(fgrep -rl 'class="instructions"' techniques/ understanding/ | grep -vc -- '-template.html$') -gt 0; then
29+
echo "::notice title=Leftover instructions paragraph in informative docs::Make sure to clean any instructions paragraphs from newly-added Techniques or Understanding pages."
30+
echo "CHECK_FAILED=1" >> "$GITHUB_ENV"
31+
fi
32+
- name: Check for changes to legacy files
33+
run: |
34+
if test $(git diff origin/${{ github.base_ref }} --numstat | egrep -c '\s(conformance-challenges|requirements|wcag20)/') -gt 0; then
35+
echo "::notice title=Legacy files modified::PRs should not change files under conformance-challenges/, requirements/, or wcag20/"
36+
echo "CHECK_FAILED=1" >> "$GITHUB_ENV"
37+
fi
38+
- name: Check for isolation of changes to TR space or informative docs
39+
run: |
40+
if test $(git diff origin/${{ github.base_ref }} --numstat | grep -c '\sguidelines/') -gt 0 &&
41+
test $(git diff origin/${{ github.base_ref }} --numstat | grep -vc '\sguidelines/') -gt 0; then
42+
echo "::notice title=Mixed TR and informative docs changes::Please submit changes to TR space separately from changes to informative docs."
43+
echo "CHECK_FAILED=1" >> "$GITHUB_ENV"
44+
fi
45+
- name: Reflect status
46+
run: |
47+
test ! $CHECK_FAILED

0 commit comments

Comments
 (0)