reusable-workflows icon indicating copy to clipboard operation
reusable-workflows copied to clipboard

[Feature Request]: Add a reusable “text-quality” workflow for spelling, grammar & style checks

Open tyrann0us opened this issue 10 months ago • 2 comments

Is your feature request related to a problem?

It is frustrating when typos, misspellings, or small grammatical slips sneak through code reviews and end up in user-facing strings, documentation, or comments. Manually checking these errors and writing suggestions is very time-consuming, so reviewers have less time for the actual code review. Therefore, often no attention is paid to text quality at all.

Describe the desired solution

Please add a text-quality.yml (or similar) reusable workflow (and companion docs) that can be dropped into any consuming repo with uses: inpsyde/reusable-workflows/.github/workflows/text-quality.yml@main.

Suggested features:

  1. Fast typo scan – run Typos (https://github.com/crate-ci/typos) over the entire tree on every PR.
  2. AST-aware spell-check – run CSpell (https://github.com/streetsidesoftware/cspell-action) on source files to catch mistakes in identifiers, string literals, and comments while recognising domain-specific names.
  3. Optional grammar/style pass – expose a RUN_GRAMMAR_JOB boolean input that, when true, launches a second job with LanguageTool via https://github.com/reviewdog/action-languagetool (Markdown & TXT only).
  4. Outputs – surface annotations inline on PRs and fail the job on errors so the calling repo can decide whether to block merges (continue-on-error default false).

Describe the alternatives that you have considered

Describe the alternatives that you have considered

  • Vale – powerful but heavier to configure; requires organisation-wide style guides.
  • Codespell – simple, but its opinionated dictionary causes more false positives in WordPress/PHP projects than Typos.
  • check-spelling – great learning mode, yet adds per-repo maintenance overhead and slower first-run times.

Additional context

Below is a minimal outline that could live inside text-quality.yml; inputs and caching are omitted for brevity (untested!):

name: text-quality
on:
  workflow_call:
    inputs:
      RUN_GRAMMAR_JOB:
        description: "Run LanguageTool grammar job"
        required: false
        default: false
jobs:
  spelling:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: crate-ci/typos-action@v1
        with:
          files: "**"
          write_changes: false

      - uses: streetsidesoftware/cspell-action@v7
        with:
          files: "**/*.{php,js,ts,tsx,md}"
          config: .github/cspell.json
  grammar:
    if: ${{ inputs.RUN_GRAMMAR_JOB == 'true' }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: reviewdog/action-languagetool@v1
        with:
          reporter: github-pr-check
          patterns: "**/*.{md,txt}"
          language: en-US

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

tyrann0us avatar May 12 '25 09:05 tyrann0us

@tyrann0us cool idea! Should we maybe combine this one with the lint markdown one from WP Scripts? I guess, whenever you have documentation, you should lint and check for misspellings, right?

Chrico avatar May 12 '25 09:05 Chrico

@tyrann0us @Chrico

We recently introduced crates-ci/typos for PPCP. So a production-ready setup & config could be glanced from here

cc @danieldudzic @InpsydeNiklas

Biont avatar Jun 03 '25 10:06 Biont