Skip to content

Add the /spell command to allow words from a PR comment - #2113

Open
marcleblanc2 wants to merge 3 commits into
mainfrom
marc/spellcheck-allow-command
Open

marcleblanc2 wants to merge 3 commits into
mainfrom
marc/spellcheck-allow-command

Conversation

@marcleblanc2

@marcleblanc2 marcleblanc2 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

PR authors / reviewers can now comment on PRs with
/spell <list of words>
to add words to the CSpell allowlist.

The spell check's summary and inline comments have been updated to inform the author the command exists.

Screenshots

issue_comment workflows only run from the default branch, so this PR cannot exercise itself; these are from a PR on a fork with this branch as its main, in the order they happen.

1. The spell check finds words: summary comment

The last line lists every flagged word, ready to paste.

Spell check summary comment with findings and the /spell instructions

2. The spell check finds words: inline review comment

Each flagged line gets the suggestion, and the /spell command for that word.

Inline review comment with the suggestion and the /spell command for that word

3. The author comments /spell <word>

The command comment gets a 👍, and the bot's commit lands on the branch. The checks run again on the new revision, and the summary comment updates to what is left.

The command comment with a thumbs up reaction, followed by the bot commit adding the word to cspell-allow-list.txt

4. No spelling errors remain

The summary comment turns green, and the check minimizes it as resolved; the inline comments are resolved too.

Spell check summary comment: this revision introduces no spelling errors

5. /spell with nothing to add

When CSpell already accepts every word given, the bot replies instead of committing.

The command comment followed by the bot reply "Already accepted"

How it works

  • .github/workflows/spellcheck-allow.yml runs on issue_comment and pull_request_review_comment whose body starts with /spell (or /spell allow), on a pull request, from someone with write access. Words are separated by spaces or commas; only the comment's first line is read.
  • dev/allow-spelling-words.mjs hands the words to CSpell and adds the parts it flags, so hyphenated, snake_case, and camelCase input is split the way CSpell splits a document, and words CSpell already accepts are left out. They go into the # Words section of cspell-allow-list.txt, in the order dev/check-spelling.mjs enforces. It works locally too: node dev/allow-spelling-words.mjs <words>.
  • The commit is pushed as github-actions[bot]. A push made with GITHUB_TOKEN leaves the pull_request runs it creates waiting for approval, so the workflow has actions: write and approves each one, and every check reports on the new revision.
  • A fork PR gets a reply instead (GITHUB_TOKEN cannot push to a fork), as does a commenter without write access. Any other failure is replied with a link to the job log.

Test plan

All on the fork, with the final workflow:

  • /spell <word> in the PR conversation: 👍, bot commit, all six pull_request runs approved and completed on the new revision, summary comment updated to the remaining findings
  • /spell <word> as a reply to an inline review comment: 👍 on the review comment, bot commit
  • /spell allow <word>, <word>: both added
  • /spell <hyphenated-word>, <snake_case_word> <camelCaseWord>: only the parts CSpell flags are added
  • /spell <accepted word>: reply, no commit
  • Summary comment lists each flagged word once (the same word in two cases collapses to one) and skips allow-list order findings
  • actionlint on the workflow; node dev/check-spelling.mjs --base HEAD reports no order issues after insertion

@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sourcegraph-docs Ignored Ignored Preview Oct 29, 2026 11:46pm UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

This comment has been minimized.

marcleblanc2 and others added 2 commits October 29, 2026 17:34
A comment of /spell <words> (or /spell allow <words>) on a PR adds the
words CSpell does not accept yet to cspell-allow-list.txt on the PR's
branch, reacts with a thumbs up, and approves the checks that the push
creates in an approval-required state, since GITHUB_TOKEN made it. The
spell check's comments tell the author about the command.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a18970-577e-71a8-83e8-89de63b0ea68
@marcleblanc2
marcleblanc2 force-pushed the marc/spellcheck-allow-command branch from ea79e21 to 7df6d2e Compare October 29, 2026 23:36

This branch was successfully deployed

1 active (outdated) deployment
Preview — 6ed70f6c Deployed Oct 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant