Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infra spell bot #35224

Merged
merged 10 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/spelling-check-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Create an issue to report typos

on:
schedule:
- cron: "0 0 * * mon"
workflow_dispatch:

jobs:
sync:
if: github.repository == 'mdn/content'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn

- name: Run scripts
run: |
npm install
echo Running spelling check...
output=$(npx cspell --no-progress --gitignore --config .vscode/cspell.json "**/*.md" || exit 0)
echo "$output"
echo "OUTPUT<<EOF" >> $GITHUB_ENV
echo "$output" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV

- name: Create an issue
if: env.OUTPUT != ''
uses: dacbd/create-issue-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: Weekly spelling check
body: |
Typos and unknown words:

```
${{ env.OUTPUT }}
```

> [!TIP]
> To exclude words from the spellchecker, you can add valid words (web technology terms or abbreviations) to the [terms-abbreviations.txt](https://github.com/mdn/content/blob/main/.vscode/terms-abbreviations.txt) dictionary for IDE autocompletion. To ignore strings that are not words (`AABBCC` in code, for instance), you can add them to [ignore-list.txt](https://github.com/mdn/content/blob/main/.vscode/ignore-list.txt).
env:
OUTPUT: ${{ env.OUTPUT }}
23 changes: 16 additions & 7 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"version": "0.2",
"language": "en-US",
"languageId": "*",
"useGitignore": true,
"dictionaries": [
"terms-abbreviations",
"ignore-list",
"bash",
"css",
"cpp",
Expand All @@ -17,7 +20,6 @@
"markdown",
"node",
"npm",
"project-words",
"python",
"softwareTerms",
"svelte",
Expand All @@ -37,10 +39,9 @@
// TODO - add some details what these match
"\\(#\\w*\\)",
"\\]\\(\\S*\\)",
"\\]\\(\\S*\\)",
"\\*\\*\\w\\*\\*\\w*",
"\\*\\w\\*\\w*",
"#[\\w-]*",
"#[À-ž\\w-]*",
"aria-activedescendant=\"(?:[^\\\"]+|\\.)*\"",
"aria-controls=\"(?:[^\\\"]+|\\.)*\"",
"aria-describedby=\"(?:[^\\\"]+|\\.)*\"",
Expand All @@ -55,18 +56,26 @@
"for=\"(?:[^\\\"]+|\\.)*\"",
"HexValues",
"href=\"(?:[^\\\"]+|\\.)*\"",
"id=\"(?:[^\\\"]+|\\.)*\"",
"(?<=id)=\"(?:[^\\\"]+|\\.)*\"",
"lang=\".*\">.*</",
"src=\"(?:[^\\\"]+|\\.)*\"",
"url\\(\"data\\:image/svg\\+xml.*\"\\)[,;]",
"Urls"
"Urls",
"favourite-colour",
"ucaf:.*\""
],
"allowCompoundWords": true,
"dictionaryDefinitions": [
{
"name": "project-words",
"path": "./project-words.txt",
"name": "terms-abbreviations",
"path": "./terms-abbreviations.txt",
"addWords": true
},
{
"name": "ignore-list",
"path": "./ignore-list.txt",
"addWords": false,
"noSuggest": true
}
],
"enableFiletypes": ["xml"]
Expand Down
Loading
Loading