docs: platform billing #1076
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
ref: ${{ github.head_ref }} | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- 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: Show available dictionaries | |
run: | | |
hunspell -D | |
- name: Spell check (Markdown) | |
shell: bash | |
run: | | |
base_branch=${{ github.base_ref }} | |
diff=$(git diff --name-only origin/$base_branch | grep -E '\.mdx?$' || true) | |
ignore_words_path=".github/actions/spell-checker/ignore_words.txt" | |
potentional_misspellings_path=$(mktemp) | |
if [[ -n "$diff" ]]; then | |
echo "🧐 Going to spell check the following files:" | |
echo "$diff" | |
echo | |
for file in $diff; do | |
normalizedFile=$(mktemp) | |
./scripts/markdown-normalizer.ts "$file" > "$normalizedFile" | |
hunspell -l -d en_US -p "$ignore_words_path" "$normalizedFile" > "$potentional_misspellings_path" | |
if [[ ! -s "$potentional_misspellings_path" ]]; then | |
echo "🦖 No potential misspellings found in $file" | |
continue | |
fi | |
output=$(grep -v -f "$ignore_words_path" "$potentional_misspellings_path" | awk NF) | |
typos_count=$(echo "$output" | awk NF | wc -w | xargs) | |
rm "$normalizedFile" | |
rm "$potentional_misspellings_path" | |
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, order alphabetically for better maintainability, 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 |