forked from blockwise-direct-search/bds
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (49 loc) · 1.71 KB
/
spell_check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Check TeX_Bib Spelling
on:
push:
paths:
- '**.tex'
- '**.bib'
- '**.txt'
- '**.yml'
jobs:
spelling_check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Hunspell
run: sudo apt-get install hunspell
- name: Check spelling
id: check_spelling
run: |
find . -type f \( -name "*.tex" -o -name "*.bib" \) ! -name "custom_dictionary.txt" -exec sh -c 'hunspell -l -t -d en_US {} | grep -v -w -f .github/actions/spell_check/custom_dictionary.txt > {}_spelling_errors.txt' \;
errors_found=false
for file in $(find . -type f -name "*_spelling_errors.txt"); do
if [ -s $file ]; then
errors_found=true
break
fi
done
if [ "$errors_found" = true ]; then
echo "Spelling errors summary:" > spelling_errors_summary.txt
for file in $(find . -type f -name "*_spelling_errors.txt"); do
if [ -s $file ]; then
echo "Spelling errors found in $(basename $file _spelling_errors.txt):" >> spelling_errors_summary.txt
cat $file >> spelling_errors_summary.txt
echo "" >> spelling_errors_summary.txt
fi
done
echo "Please fix the spelling errors listed in 'spelling_errors_summary.txt'."
cat spelling_errors_summary.txt
exit 1
else
echo "No spelling errors found."
rm -f *_spelling_errors.txt
fi
- name: Upload spelling errors summary
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: spelling_errors_summary
path: spelling_errors_summary.txt