How to Run a Spellcheck in GitHub Actions
Typos in docs and identifiers slip past review; a spellcheck catches the obvious ones automatically.
Run codespell across the repo with an ignore list for intentional jargon so genuine typos fail the job.
Steps
- Install
codespellwith pip. - Run it against the tree with a
--skiplist for vendored paths. - Maintain an ignore-words file for domain terms it flags incorrectly.
Workflow
.github/workflows/spellcheck.yml
name: Spellcheck
on: [pull_request]
jobs:
spell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install codespell
- run: codespell --skip='./node_modules,./dist,*.lock' --ignore-words=.codespellignoreNotes
- Keep
.codespellignoreshort and reviewed, or it quietly hides real typos. - On Latchkey managed runners spellcheck jobs run cheaper and self-heal if a runner dies.
Related guides
How to Deploy Docs to GitHub Pages with MkDocs in GitHub ActionsBuild an MkDocs site in GitHub Actions and publish it to GitHub Pages with the Pages deploy action so docs up…
How to Lint YAML with yamllint in GitHub ActionsLint YAML files in GitHub Actions with yamllint so indentation and syntax mistakes fail CI before they break…