Skip to content

Commit caacbf2

Browse files
committed
github action cspell
Add a github action to check spelling of all files. Include a config and a list of project-words (words to be ignored by spell-checking) under `.cspell`.
1 parent 60b5f05 commit caacbf2

File tree

7 files changed

+51
-0
lines changed

7 files changed

+51
-0
lines changed

.cspell/cspell.config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
version: '0.2'
3+
dictionaryDefinitions:
4+
- name: project-words
5+
path: './project-words.txt'
6+
addWords: true
7+
dictionaries:
8+
- project-words
9+
ignorePaths:
10+
- '/project-words.txt'

.cspell/project-words.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
gitlint
2+
shellcheck

.github/actions/cspell/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: 'cspell'
3+
description:
4+
'Checks spelling of all files in repo'
5+
runs:
6+
using: 'composite'
7+
steps:
8+
- run: sudo npm install -g cspell@latest
9+
shell: bash
10+
- run: echo "::add-matcher::.github/matchers/cspell.json"
11+
shell: bash
12+
- run: ./scripts/cspell.sh
13+
shell: bash

.github/matchers/cspell.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "shellcheck",
5+
"pattern": [
6+
{
7+
"regexp": "^(.+):(\\d+):(\\d+) - (.+)$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"message": 4
12+
}
13+
]
14+
}
15+
]
16+
}

.github/workflows/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,8 @@ jobs:
3434
steps:
3535
- uses: actions/checkout@v4
3636
- uses: ./.github/actions/jq_format
37+
cspell:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
- uses: ./.github/actions/cspell

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Needed for cspell
2+
.git

scripts/cspell.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
cspell -c ./.cspell/cspell.config.yaml --no-progress --no-summary --show-suggestions --no-cache --dot --gitignore "**"

0 commit comments

Comments
 (0)