Skip to content

chore: 🧹 2024-06-06 release: fixes pricing table, adds landing page hotfixes #21

chore: 🧹 2024-06-06 release: fixes pricing table, adds landing page hotfixes

chore: 🧹 2024-06-06 release: fixes pricing table, adds landing page hotfixes #21

name: 🧐 Spell checker (Grammar)
on:
pull_request:
jobs:
spellcheck:
runs-on: ubuntu-latest
env:
MAX_NUMBER_OF_TYPOS: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Hunspell
run: |
sudo apt-get update
# Hunspell along with the English (US) dictionary
sudo apt-get install -y hunspell hunspell-en-us
- name: Spell check (Markdown)
run: |
base_branch=${{ github.base_ref }}
diff=$(git diff --name-only origin/$base_branch | grep -E '\.mdx?$' || true)
if [[ -n "$diff" ]]; then
echo "🧐 Going to spell check the following files:"
echo "$diff"
echo
for file in $diff; do
output=$(hunspell -l -d en_US -p .github/actions/spell-checker/ignore_words.txt "$file")
typos_count=$(echo "$output" | wc -l)
if [[ -n "$output" ]]; then
echo "🤓 Found the following typos in $file"
echo
echo "$output"
echo
echo "👆 If there are false positives, help us improve by adding the word to the ignore list in the location .github/actions/spell-checker/ignore_words.txt, please!"
fi
if [[ "$typos_count" -gt "$MAX_NUMBER_OF_TYPOS" ]]; then
echo "👹 Oops! The number of typos found exceed the maximum allowed count of $MAX_NUMBER_OF_TYPOS"
exit 1
fi
done
else
echo "🦖Oh-No! No markdown files were found to be modified, so no spell check happened."
fi