### Basic Codespell Action Setup Source: https://github.com/codespell-project/actions-codespell/blob/master/README.md Integrate Codespell into your GitHub Actions workflow by checking out your code and then using the codespell-project/actions-codespell action. ```yaml - uses: actions/checkout@v5 - uses: codespell-project/actions-codespell@v2 ``` -------------------------------- ### Full Production Workflow Example Source: https://context7.com/codespell-project/actions-codespell/llms.txt A comprehensive GitHub Actions workflow demonstrating codespell usage with path scoping, hidden file checking, filename checking, skip patterns, and a separate pass with an ignore word list. It includes two passes: one for source code and another for documentation with `only_warn` enabled. ```yaml # .github/workflows/codespell.yml name: Spell Check on: push: branches: [main, develop] pull_request: jobs: codespell: name: Check for spelling errors runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 # Main pass: check all source code, skip generated/vendored paths - uses: codespell-project/actions-codespell@v2 with: check_filenames: true check_hidden: true skip: "./.git,./vendor,./node_modules,./dist,*.min.js,*.lock" builtin: "clear,rare" ignore_words_file: .codespellignore # Secondary pass: check documentation files, ignoring known false positives - uses: codespell-project/actions-codespell@v2 with: path: "./docs,./README.md,./CHANGELOG.md" ignore_words_list: "abandonned,ackward" only_warn: 1 # don't block on docs — just annotate ``` -------------------------------- ### Register codespell problem matcher for pip-based checks Source: https://context7.com/codespell-project/actions-codespell/llms.txt This companion action registers problem matcher patterns for the GitHub Actions runner, enabling PR annotations when `codespell` is invoked directly (e.g., via `pip install`). It registers two patterns: `codespell-matcher-default` and `codespell-matcher-specified`. ```yaml name: Spell Check (pip-based) on: [pull_request] jobs: codespell: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Register codespell problem matcher uses: codespell-project/actions-codespell/codespell-problem-matcher@v2 - name: Install and run codespell run: | pip install "codespell[toml]>=2.2.4" codespell --count --ignore-words-list abandonned src/ ``` -------------------------------- ### Codespell Action with Hidden File Checking Source: https://github.com/codespell-project/actions-codespell/blob/master/README.md Enable checking of hidden files (those starting with '.') for spelling errors by setting the `check_hidden` parameter to `true`. ```yaml uses: codespell-project/actions-codespell@v2 with: check_hidden: true ``` -------------------------------- ### Provide a codespell config file Source: https://context7.com/codespell-project/actions-codespell/llms.txt The `config` option allows you to specify a path to a codespell configuration file (e.g., `setup.cfg`, `pyproject.toml`). The action exits with code 78 if the configuration file is malformed. ```toml [tool.codespell] skip = "*.lock,vendor" ignore-words-list = "abandonned" count = true ``` ```yaml - uses: codespell-project/actions-codespell@v2 with: config: pyproject.toml ``` -------------------------------- ### Codespell Action with Skipped Files Source: https://github.com/codespell-project/actions-codespell/blob/master/README.md Provide a comma-separated list of files or globs to skip during the spell check using the `skip` parameter. ```yaml uses: codespell-project/actions-codespell@v2 with: skip: foo,bar ``` -------------------------------- ### Pre-commit hook configuration Source: https://context7.com/codespell-project/actions-codespell/llms.txt Integrate codespell as a pre-commit hook by adding it to your `.pre-commit-config.yaml`. This allows you to catch misspellings locally before pushing code. Specify `args` for custom ignore lists and `additional_dependencies` if needed. ```yaml # .pre-commit-config.yaml repos: - repo: https://github.com/codespell-project/codespell rev: v2.4.2 hooks: - id: codespell args: [--ignore-words-list, "abandonned,ackward,bu"] additional_dependencies: - tomli # required for pyproject.toml config support ``` -------------------------------- ### Select Built-in Dictionaries for Codespell Source: https://context7.com/codespell-project/actions-codespell/llms.txt A comma-separated list of codespell built-in dictionary sets to activate. Enables stricter checking beyond the default dictionary. ```yaml - uses: codespell-project/actions-codespell@v2 with: builtin: "clear,rare,names" # Equivalent CLI: codespell --count --builtin clear,rare,names # Enables stricter checking beyond the default dictionary. ``` -------------------------------- ### Minimal Default Usage of Codespell Action Source: https://context7.com/codespell-project/actions-codespell/llms.txt Run codespell over the entire repository with default settings. Misspellings are automatically annotated on the PR diff. ```yaml # .github/workflows/spell-check.yml name: Spell Check on: [push, pull_request] jobs: codespell: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: codespell-project/actions-codespell@v2 # Exit code: 0 (clean) or 65 (misspellings found) # All misspellings are annotated on the PR diff automatically. ``` -------------------------------- ### Codespell Action with Only Warn Source: https://github.com/codespell-project/actions-codespell/blob/master/README.md Configure the Codespell action to only warn about problems without failing the build. The exit code will always be 0. ```yaml uses: codespell-project/actions-codespell@v2 with: only_warn: 1 ``` -------------------------------- ### Codespell Action with Custom Path Source: https://github.com/codespell-project/actions-codespell/blob/master/README.md Specify a custom path for Codespell to run in, useful for excluding certain directories from the check. Defaults to the entire repository. ```yaml uses: codespell-project/actions-codespell@v2 with: path: src ``` -------------------------------- ### Add codespell-problem-matcher to GitHub Actions Workflow Source: https://github.com/codespell-project/actions-codespell/blob/master/codespell-problem-matcher/README.md Include this step in your workflow before executing codespell to enable annotation of its errors. ```yaml - uses: codespell-project/codespell-problem-matcher@v1 ``` -------------------------------- ### Non-blocking warn mode Source: https://context7.com/codespell-project/actions-codespell/llms.txt Set `only_warn` to a non-empty value to ensure the action always exits with code 0, regardless of misspellings. This creates annotations on the PR but prevents the workflow step from failing, useful for introducing spell checking or managing known legacy misspellings. ```yaml - uses: codespell-project/actions-codespell@v2 with: only_warn: 1 ``` -------------------------------- ### Codespell Action with Ignore Words File Source: https://github.com/codespell-project/actions-codespell/blob/master/README.md Specify a file containing words to be ignored by Codespell. Each word should be on a new line. Words are case-sensitive. ```yaml uses: codespell-project/actions-codespell@v2 with: ignore_words_file: .codespellignore ``` -------------------------------- ### Codespell Action with URI Ignore Words List Source: https://github.com/codespell-project/actions-codespell/blob/master/README.md Configure a comma-separated list of words to ignore specifically within URIs and emails. Setting to '*' ignores all such misspellings. ```yaml uses: codespell-project/actions-codespell@v2 with: uri_ignore_words_list: abandonned ``` -------------------------------- ### Codespell Action with Filename Checking Source: https://github.com/codespell-project/actions-codespell/blob/master/README.md Configure the Codespell action to also check file names for spelling mistakes by setting the `check_filenames` parameter to `true`. ```yaml uses: codespell-project/actions-codespell@v2 with: check_filenames: true ``` -------------------------------- ### Ignore Words Inside URIs and Emails Only Source: https://context7.com/codespell-project/actions-codespell/llms.txt Provides a comma-separated list of words to ignore when they appear inside a URI or email address. Use "*" to suppress all URI/email misspelling warnings. ```yaml - uses: codespell-project/actions-codespell@v2 with: uri_ignore_words_list: "bui,abandonned" # Equivalent CLI: codespell --count --uri-ignore-words-list bui,abandonned ``` -------------------------------- ### Enable Hidden File and Directory Checking Source: https://context7.com/codespell-project/actions-codespell/llms.txt When set to true, codespell will also scan files and directories whose names begin with a dot (.). Scans .env, .github/, .eslintrc, etc. for spelling mistakes. ```yaml - uses: codespell-project/actions-codespell@v2 with: check_hidden: true # Equivalent CLI: codespell --count --check-hidden # Scans .env, .github/, .eslintrc, etc. for spelling mistakes. ``` -------------------------------- ### Codespell Action with Built-in Dictionaries Source: https://github.com/codespell-project/actions-codespell/blob/master/README.md Use specific built-in dictionaries for spell checking by providing a comma-separated list to the `builtin` parameter. ```yaml uses: codespell-project/actions-codespell@v2 with: builtin: clear,rare ``` -------------------------------- ### Codespell Action with Ignore Words List Source: https://github.com/codespell-project/actions-codespell/blob/master/README.md Provide a comma-separated list of words to be ignored by Codespell. Words are case-sensitive. ```yaml uses: codespell-project/actions-codespell@v2 with: ignore_words_list: abandonned,ackward ``` -------------------------------- ### Ignore Words from a File in Codespell Source: https://context7.com/codespell-project/actions-codespell/llms.txt Specifies the path to a file (one word per line) of words that codespell should ignore. Useful for maintaining a persistent ignore list in the repository. ```yaml # .codespellignore # abandonned # ackward # buid - uses: codespell-project/actions-codespell@v2 with: ignore_words_file: .codespellignore # Equivalent CLI: codespell --count --ignore-words .codespellignore ``` -------------------------------- ### Codespell Action with Exclude File Source: https://github.com/codespell-project/actions-codespell/blob/master/README.md Specify a file containing lines that should not be checked for spelling mistakes using the `exclude_file` parameter. ```yaml uses: codespell-project/actions-codespell@v2 with: exclude_file: src/foo ``` -------------------------------- ### Skip Files or Globs in Codespell Scan Source: https://context7.com/codespell-project/actions-codespell/llms.txt Provides a comma-separated list of file names or glob patterns that codespell should not check. Useful for minified files, vendored code, or auto-generated documentation. ```yaml - uses: codespell-project/actions-codespell@v2 with: skip: "*.min.js,vendor,./third_party/**,./docs/generated" # Equivalent CLI: codespell --count --skip *.min.js,vendor,./third_party/**,./docs/generated # Useful for minified files, vendored code, or auto-generated documentation. ``` -------------------------------- ### Ignore Specific Words Inline in Codespell Source: https://context7.com/codespell-project/actions-codespell/llms.txt Provides a comma-separated list of words that codespell should treat as correct. Suppresses false positives for project-specific terminology or known codespell quirks. ```yaml - uses: codespell-project/actions-codespell@v2 with: ignore_words_list: "abandonned,ackward,buid" # Equivalent CLI: codespell --count --ignore-words-list abandonned,ackward,buid # Suppresses false positives for project-specific terminology or known codespell quirks. ``` -------------------------------- ### Exclude specific lines from checking Source: https://context7.com/codespell-project/actions-codespell/llms.txt Use `exclude_file` to specify a file containing exact lines to be skipped during spell checking. This is useful for ignoring specific phrases or URLs that might be flagged as false positives. ```yaml - uses: codespell-project/actions-codespell@v2 with: exclude_file: test/exclude-lines.txt ``` -------------------------------- ### Restrict Codespell Scan to a Subdirectory Source: https://context7.com/codespell-project/actions-codespell/llms.txt Limits codespell to a specific path instead of scanning the whole repository. Only files under the specified path are checked. ```yaml - uses: codespell-project/actions-codespell@v2 with: path: src # Equivalent CLI: codespell --count src # Only files under ./src/ are checked; everything else is ignored. ``` -------------------------------- ### Enable Filename Checking in Codespell Source: https://context7.com/codespell-project/actions-codespell/llms.txt When set to true, codespell also checks the file names themselves for typos, not just their contents. A file named 'abandonned.txt' would produce a warning. ```yaml - uses: codespell-project/actions-codespell@v2 with: check_filenames: true # Equivalent CLI: codespell --count --check-filenames # A file named "abandonned.txt" would produce a warning on its filename. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.