Skip to content

Commit c2faaaa

Browse files
committed
Added support for PySpelling 2.11
1 parent f41824d commit c2faaaa

File tree

5 files changed

+68
-13
lines changed

5 files changed

+68
-13
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change Log for spellcheck-github-actions
22

3+
## 0.52.0, 2025-09-10, feature release, update not required
4+
5+
- With version 2.11 of **PySpelling** a new command line option `--skip-dict-compile` is introduced to **PySpelling** and is adopted by this action. This will skip the dictionary compiling step if the dictionary already exists. Changes to a custom dictionary will be ignored., see the [release notes for PySpelling](https://github.com/facelessuser/pyspelling/releases/tag/2.11). Do see the updated documentation for details.
6+
7+
- The feature can be enabled by setting the input parameter `skip_dict_compile` to `true`, the default is `false`, meaning that the dictionary will be compiled on each run of the action.
8+
- This can save time if you have a large custom dictionary that does not change often.
9+
310
## 0.51.0, 2025-06-20, maintenance release, update not required
411

512
- Docker image updated to Python 3.13.5 slim via PR [#249](https://github.com/rojopolis/spellcheck-github-actions/pull/249) from Dependabot. [Release notes for Python 3.13.5](https://docs.python.org/release/3.13.5/whatsnew/changelog.html)

README.md

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ This action uses [PySpelling][pyspelling] to check spelling in source files in t
3535
- [Specifying Language and spellchecker](#specifying-language-and-spellchecker)
3636
- [Checking For Bad Spelling](#checking-for-bad-spelling)
3737
- [Language Support](#language-support)
38+
- [Configuring Action to Skip Custom Dictionary Compilation if Not Needed](#configuring-action-to-skip-custom-dictionary-compilation-if-not-needed)
3839
- [Tips](#tips)
3940
- [How to declutter your root directory from Spellcheck configuration files](#how-to-declutter-your-root-directory-from-spellcheck-configuration-files)
4041
- [Specify Code Not To Have Spelling Checked](#specify-code-not-to-have-spelling-checked)
@@ -108,7 +109,7 @@ jobs:
108109
steps:
109110
# The checkout step
110111
- uses: actions/checkout@v3
111-
- uses: rojopolis/spellcheck-github-actions@0.51.0
112+
- uses: rojopolis/spellcheck-github-actions@0.52.0
112113
name: Spellcheck
113114
```
114115
@@ -206,7 +207,7 @@ jobs:
206207
steps:
207208
# The checkout step
208209
- uses: actions/checkout@v3
209-
- uses: rojopolis/spellcheck-github-actions@0.51.0
210+
- uses: rojopolis/spellcheck-github-actions@0.52.0
210211
name: Spellcheck
211212
with:
212213
source_files: README.md CHANGELOG.md notes/Notes.md
@@ -234,7 +235,7 @@ jobs:
234235
steps:
235236
# The checkout step
236237
- uses: actions/checkout@v3
237-
- uses: rojopolis/spellcheck-github-actions@0.51.0
238+
- uses: rojopolis/spellcheck-github-actions@0.52.0
238239
name: Spellcheck
239240
with:
240241
source_files: README.md CHANGELOG.md notes/Notes.md
@@ -332,7 +333,7 @@ jobs:
332333
runs-on: ubuntu-latest
333334
steps:
334335
- uses: actions/checkout@v3
335-
- uses: rojopolis/spellcheck-github-actions@0.51.0
336+
- uses: rojopolis/spellcheck-github-actions@0.52.0
336337
name: Spellcheck
337338
with:
338339
config_path: config/.spellcheck.yml # put path to configuration file here
@@ -463,7 +464,7 @@ See the documentation for [PySpelling](https://facelessuser.github.io/pyspelling
463464
The action can be specified to use `hunspell` instead of `aspell` by setting the `spellchecker` parameter to `hunspell`.
464465

465466
```yaml
466-
- uses: rojopolis/spellcheck-github-actions@0.51.0
467+
- uses: rojopolis/spellcheck-github-actions@0.52.0
467468
name: Spellcheck
468469
with:
469470
task_name: Markdown
@@ -550,6 +551,30 @@ Currently only the following languages are supported via [Hunspell][hunspell]:
550551

551552
Additional languages can be added by request, please open an issue.
552553

554+
## Configuring Action to Skip Custom Dictionary Compilation if Not Needed
555+
556+
If you want to skip the compilation of the custom dictionary, you can set the `skip_dict_compile` input to `true` in your action configuration:
557+
558+
```yaml
559+
name: Spellcheck Action
560+
on: push
561+
jobs:
562+
build:
563+
name: Spellcheck
564+
runs-on: ubuntu-latest
565+
steps:
566+
- uses: actions/checkout@v3
567+
- uses: rojopolis/spellcheck-github-actions@0.52.0
568+
name: Spellcheck
569+
with:
570+
config_path: .github/spellcheck.yml
571+
skip_dict_compile: true # <--- set to true to skip custom dictionary compilation
572+
```
573+
574+
This can be useful if you have a large custom dictionary that does not change often, as it can save time during the action run.
575+
576+
The feature was added in version `0.52.0` of the action and it can be disabled by setting the input to `false` or omitting it altogether. The default value is `false`.
577+
553578
## Tips
554579

555580
### How to declutter your root directory from Spellcheck configuration files
@@ -570,7 +595,7 @@ jobs:
570595
runs-on: ubuntu-latest
571596
steps:
572597
- uses: actions/checkout@v3
573-
- uses: rojopolis/spellcheck-github-actions@0.51.0
598+
- uses: rojopolis/spellcheck-github-actions@0.52.0
574599
name: Spellcheck
575600
with:
576601
config_path: .github/spellcheck.yml # <--- put path to configuration file here
@@ -811,7 +836,7 @@ jobs:
811836
runs-on: ubuntu-latest
812837
steps:
813838
- uses: actions/checkout@v3
814-
- uses: rojopolis/spellcheck-github-actions@0.51.0
839+
- uses: rojopolis/spellcheck-github-actions@0.52.0
815840
name: Spellcheck
816841
```
817842

action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ inputs:
2222
description: |
2323
The spell checker to use. Either `hunspell` or `aspell`.
2424
required: false
25+
skip_dict_compile:
26+
description: |
27+
Skip dictionary compiling step if the dictionary already exists.
28+
Changes to a custom dictionary will be ignored.
29+
Accepts "true" or "false" and defaults to "false".
30+
required: false
2531
branding:
2632
color: green
2733
icon: type
2834
runs:
2935
using: docker
30-
image: 'docker://jonasbn/github-action-spellcheck:0.51.0'
36+
image: 'docker://jonasbn/github-action-spellcheck:0.52.0'

entrypoint.sh

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,23 @@ if [ -n "$INPUT_SPELL_CHECKER" ]; then
129129
fi
130130
fi
131131

132+
SKIP_DICT_COMPILE='true'
133+
if [ -n "$INPUT_SKIP_DICT_COMPILE" ]; then
134+
if [ "${INPUT_SKIP_DICT_COMPILE,,}" = "true" ]; then # lowercased INPUT_SKIP_DICT_COMPILE for caseinsensitive compare
135+
echo "Skipping dictionary compilation via action configuration"
136+
SKIP_DICT_COMPILE="true"
137+
elif [ "${INPUT_SKIP_DICT_COMPILE,,}" = "false" ]; then # lowercased INPUT_SKIP_DICT_COMPILE for caseinsensitive compare
138+
echo "Not skipping dictionary compilation via action configuration"
139+
else
140+
echo "Invalid value for skip_dict_compile, using default: false"
141+
fi
142+
fi
143+
144+
COMMAND="pyspelling --verbose"
145+
if [ "$SKIP_DICT_COMPILE" = "false" ]; then
146+
COMMAND="$COMMAND --skip-dict-compile"
147+
fi
148+
132149
EXITCODE=0
133150

134151
# shellcheck disable=SC2086
@@ -137,16 +154,16 @@ EXITCODE=0
137154
# source and name are included in the parameters used
138155

139156
if [ -n "$INPUT_OUTPUT_FILE" ] && [ -n "$SOURCES_LIST" ]; then
140-
pyspelling --verbose --config "$SPELLCHECK_CONFIG_FILE" --spellchecker "$SPELL_CHECKER" $TASK_NAME $SOURCES_LIST | tee "$INPUT_OUTPUT_FILE"
157+
$COMMAND --config "$SPELLCHECK_CONFIG_FILE" --spellchecker "$SPELL_CHECKER" $TASK_NAME $SOURCES_LIST | tee "$INPUT_OUTPUT_FILE"
141158
EXITCODE=${PIPESTATUS[0]}
142159
elif [ -n "$INPUT_OUTPUT_FILE" ]; then
143-
pyspelling --verbose --config "$SPELLCHECK_CONFIG_FILE" --spellchecker "$SPELL_CHECKER" $TASK_NAME | tee "$INPUT_OUTPUT_FILE"
160+
$COMMAND --config "$SPELLCHECK_CONFIG_FILE" --spellchecker "$SPELL_CHECKER" $TASK_NAME | tee "$INPUT_OUTPUT_FILE"
144161
EXITCODE=${PIPESTATUS[0]}
145162
elif [ -n "$SOURCES_LIST" ]; then
146-
pyspelling --verbose --config "$SPELLCHECK_CONFIG_FILE" --spellchecker "$SPELL_CHECKER" $TASK_NAME $SOURCES_LIST
163+
$COMMAND --config "$SPELLCHECK_CONFIG_FILE" --spellchecker "$SPELL_CHECKER" $TASK_NAME $SOURCES_LIST
147164
EXITCODE=$?
148165
elif [ -z "$INPUT_SOURCE_FILES" ]; then
149-
pyspelling --verbose --config "$SPELLCHECK_CONFIG_FILE" --spellchecker "$SPELL_CHECKER" $TASK_NAME
166+
$COMMAND --config "$SPELLCHECK_CONFIG_FILE" --spellchecker "$SPELL_CHECKER" $TASK_NAME
150167
EXITCODE=$?
151168
else
152169
echo "No files to check, exiting"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ html5lib==1.1
55
lxml==5.3.0
66
Markdown==3.7
77
pymdown-extensions==10.15.0
8-
pyspelling==2.10
8+
pyspelling==2.11
99
PyYAML==6.0.2
1010
six==1.16.0
1111
soupsieve==2.6

0 commit comments

Comments
 (0)