Skip to content

Commit 9c12bb5

Browse files
authored
feat: spell check workflow (#76)
1 parent 05d4d98 commit 9c12bb5

File tree

4 files changed

+143
-2
lines changed

4 files changed

+143
-2
lines changed

.github/cspell.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": "0.2",
3+
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
4+
"dictionaries": ["vgv_allowed", "vgv_forbidden"],
5+
"dictionaryDefinitions": [
6+
{
7+
"name": "vgv_allowed",
8+
"path": "https://raw.githubusercontent.com/verygoodopensource/very_good_dictionaries/main/allowed.txt",
9+
"description": "Allowed VGV Spellings"
10+
},
11+
{
12+
"name": "vgv_forbidden",
13+
"path": "https://raw.githubusercontent.com/verygoodopensource/very_good_dictionaries/main/forbidden.txt",
14+
"description": "Forbidden VGV Spellings"
15+
}
16+
],
17+
"useGitignore": true
18+
}

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ jobs:
3535
verify-semantic-pull-request:
3636
uses: ./.github/workflows/semantic_pull_request.yml
3737

38+
verify-spell-check:
39+
uses: ./.github/workflows/spell_check.yml
40+
with:
41+
modified_files_only: false
42+
3843
build:
3944
needs:
4045
[
@@ -43,6 +48,7 @@ jobs:
4348
verify-pana-dart,
4449
verify-pana-flutter,
4550
verify-semantic-pull-request,
51+
verify-spell-check,
4652
]
4753

4854
runs-on: ubuntu-latest

.github/workflows/spell_check.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Spell Check Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
config:
7+
required: false
8+
type: string
9+
default: ".github/cspell.json"
10+
includes:
11+
required: false
12+
type: string
13+
default: ""
14+
runs_on:
15+
required: false
16+
type: string
17+
default: "ubuntu-latest"
18+
verbose:
19+
required: false
20+
type: boolean
21+
default: false
22+
modified_files_only:
23+
required: false
24+
type: boolean
25+
default: true
26+
working_directory:
27+
required: false
28+
type: string
29+
default: "."
30+
31+
jobs:
32+
build:
33+
defaults:
34+
run:
35+
working-directory: ${{inputs.working_directory}}
36+
37+
runs-on: ${{inputs.runs_on}}
38+
39+
steps:
40+
- name: 📚 Git Checkout
41+
uses: actions/checkout@v3
42+
43+
- name: 🪄 Spell Check
44+
uses: streetsidesoftware/cspell-action@v2
45+
with:
46+
config: ${{inputs.config}}
47+
files: ${{inputs.includes}}
48+
incremental_files_only: ${{inputs.modified_files_only}}
49+
root: ${{inputs.working_directory}}
50+
verbose: ${{inputs.verbose}}

README.md

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ The Dart package workflow consists of the following steps:
7878

7979
#### `analyze_directories`
8080

81-
**Optional** A space seperated list of folders that should be analyzed.
81+
**Optional** A space separated list of folders that should be analyzed.
8282

8383
**Default** `"lib test"`
8484

8585
#### `report_on`
8686

87-
**Optional** A comma seperated list of folders that should be checked in code coverage.
87+
**Optional** A comma separated list of folders that should be checked in code coverage.
8888

8989
**Default** `"lib"`
9090

@@ -274,6 +274,73 @@ jobs:
274274
working_directory: "examples/my_flutter_package"
275275
```
276276

277+
## Spell Check Workflow
278+
279+
### Steps
280+
281+
The spell check workflow consists of the following steps:
282+
283+
1. Git Checkout
284+
2. Run Spell Check
285+
286+
### Inputs
287+
288+
#### `config`
289+
290+
**Optional** The location of the `cspell.json`.
291+
292+
**Default** `".github/cspell.json"`
293+
294+
#### `includes`
295+
296+
**Optional** The glob patterns to filter the files to be checked. Use a new line between patterns to define multiple patterns.
297+
298+
**Default** `""`
299+
300+
#### `working_directory`
301+
302+
**Optional** The path to the root of the Dart package.
303+
304+
**Default** `"."`
305+
306+
#### `runs_on`
307+
308+
**Optional** An optional operating system on which to run the workflow.
309+
310+
**Default** `"ubuntu-latest"`
311+
312+
#### `verbose`
313+
314+
**Optional** An optional boolean which determines whether to log verbose output.
315+
316+
**Default** `false`
317+
318+
#### `modified_files_only`
319+
320+
**Optional** An optional boolean which determines whether spell check is run on modified files.
321+
322+
**Default** `true`
323+
324+
### Example Usage
325+
326+
```yaml
327+
name: My Workflow
328+
329+
on: pull_request
330+
331+
jobs:
332+
build:
333+
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/spell_check.yml@v1
334+
with:
335+
includes: |
336+
**/*.{dart,md,yaml}
337+
!.dart_tool/**/*.{dart,yaml}
338+
.*/**/*.yml
339+
runs_on: macos-latest
340+
modified_files_only: false
341+
working_directory: examples/my_project
342+
```
343+
277344
[ci_badge]: https://github.com/VeryGoodOpenSource/very_good_workflows/actions/workflows/ci.yml/badge.svg
278345
[ci_link]: https://github.com/VeryGoodOpenSource/very_good_workflows/actions
279346
[github_workflows_link]: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions

0 commit comments

Comments
 (0)