Skip to content

Commit 3d3776a

Browse files
committed
Add check-spelling
0 parents  commit 3d3776a

File tree

1 file changed

+239
-0
lines changed

1 file changed

+239
-0
lines changed

.github/workflows/spelling.yml

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
name: Check Spelling
2+
3+
# Comment management is handled through a secondary job, for details see:
4+
# https://github.com/check-spelling/check-spelling/wiki/Feature%3A-Restricted-Permissions
5+
#
6+
# `jobs.comment-push` runs when a push is made to a repository and the `jobs.spelling` job needs to make a comment
7+
# (in odd cases, it might actually run just to collapse a comment, but that's fairly rare)
8+
# it needs `contents: write` in order to add a comment.
9+
#
10+
# `jobs.comment-pr` runs when a pull_request is made to a repository and the `jobs.spelling` job needs to make a comment
11+
# or collapse a comment (in the case where it had previously made a comment and now no longer needs to show a comment)
12+
# it needs `pull-requests: write` in order to manipulate those comments.
13+
14+
# Updating pull request branches is managed via comment handling.
15+
# For details, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-expect-list
16+
#
17+
# These elements work together to make it happen:
18+
#
19+
# `on.issue_comment`
20+
# This event listens to comments by users asking to update the metadata.
21+
#
22+
# `jobs.update`
23+
# This job runs in response to an issue_comment and will push a new commit
24+
# to update the spelling metadata.
25+
#
26+
# `with.experimental_apply_changes_via_bot`
27+
# Tells the action to support and generate messages that enable it
28+
# to make a commit to update the spelling metadata.
29+
#
30+
# `with.ssh_key`
31+
# In order to trigger workflows when the commit is made, you can provide a
32+
# secret (typically, a write-enabled github deploy key).
33+
#
34+
# For background, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-with-deploy-key
35+
36+
# SARIF reporting
37+
#
38+
# Access to SARIF reports is generally restricted (by GitHub) to members of the repository.
39+
#
40+
# Requires enabling `security-events: write`
41+
# and configuring the action with `use_sarif: 1`
42+
#
43+
# For information on the feature, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-SARIF-output
44+
45+
# Minimal workflow structure:
46+
#
47+
# on:
48+
# push:
49+
# ...
50+
# pull_request_target:
51+
# ...
52+
# jobs:
53+
# # you only want the spelling job, all others should be omitted
54+
# spelling:
55+
# # remove `security-events: write` and `use_sarif: 1`
56+
# # remove `experimental_apply_changes_via_bot: 1`
57+
# ... otherwise adjust the `with:` as you wish
58+
59+
on:
60+
push:
61+
branches:
62+
- "**"
63+
tags-ignore:
64+
- "**"
65+
pull_request_target:
66+
branches:
67+
- "**"
68+
types:
69+
- "opened"
70+
- "reopened"
71+
- "synchronize"
72+
issue_comment:
73+
types:
74+
- "created"
75+
76+
jobs:
77+
spelling:
78+
name: Check Spelling
79+
permissions:
80+
contents: read
81+
pull-requests: read
82+
actions: read
83+
security-events: write
84+
outputs:
85+
followup: ${{ steps.spelling.outputs.followup }}
86+
runs-on: ubuntu-latest
87+
if: ${{ contains(github.event_name, 'pull_request') || github.event_name == 'push' }}
88+
concurrency:
89+
group: spelling-${{ github.event.pull_request.number || github.ref }}
90+
# note: If you use only_check_changed_files, you do not want cancel-in-progress
91+
cancel-in-progress: true
92+
steps:
93+
- name: check-spelling
94+
id: spelling
95+
uses: check-spelling/check-spelling@prerelease
96+
with:
97+
suppress_push_for_open_pull_request: ${{ github.actor != 'dependabot[bot]' && 1 }}
98+
checkout: true
99+
check_file_names: 1
100+
spell_check_this: check-spelling/spell-check-this@prerelease
101+
post_comment: 0
102+
use_magic_file: 1
103+
report-timing: 1
104+
warnings: bad-regex,binary-file,deprecated-feature,ignored-expect-variant,large-file,limited-references,no-newline-at-eof,noisy-file,non-alpha-in-dictionary,token-is-substring,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration,no-files-to-check,unclosed-block-ignore-begin,unclosed-block-ignore-end
105+
experimental_apply_changes_via_bot: 1
106+
use_sarif: ${{ (!github.event.pull_request || (github.event.pull_request.head.repo.full_name == github.repository)) && 1 }}
107+
extra_dictionary_limit: 20
108+
dictionary_source_prefixes: >
109+
{
110+
"cspell": "https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/",
111+
"cspell1": "https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20241114/dictionaries/"
112+
}
113+
check_extra_dictionaries: |
114+
cspell1:ada/ada.txt
115+
cspell1:aws/aws.txt
116+
cspell1:clojure/clojure.txt
117+
cspell1:companies/companies.txt
118+
cspell1:cpp/compiler-clang-attributes.txt
119+
cspell1:cpp/compiler-gcc.txt
120+
cspell1:cpp/compiler-msvc.txt
121+
cspell1:cpp/ecosystem.txt
122+
cspell1:cpp/lang-jargon.txt
123+
cspell1:cpp/lang-keywords.txt
124+
cspell1:cpp/people.txt
125+
cspell1:cpp/stdlib-c.txt
126+
cspell1:cpp/stdlib-cerrno.txt
127+
cspell1:cpp/stdlib-cmath.txt
128+
cspell1:cpp/stdlib-cpp.txt
129+
cspell1:cpp/template-strings.txt
130+
cspell1:cryptocurrencies/cryptocurrencies.txt
131+
cspell1:csharp/csharp.txt
132+
cspell1:css/css.txt
133+
cspell1:dart/dart.txt
134+
cspell1:django/django.txt
135+
cspell1:django/requirements.txt
136+
cspell1:docker/docker-words.txt
137+
cspell1:dotnet/dotnet.txt
138+
cspell1:elixir/elixir.txt
139+
cspell1:filetypes/filetypes.txt
140+
cspell1:fonts/fonts.txt
141+
cspell1:fullstack/fullstack.txt
142+
cspell1:gaming-terms/gaming-terms.txt
143+
cspell1:golang/go.txt
144+
cspell1:haskell/haskell.txt
145+
cspell1:html/html.txt
146+
cspell1:java/java-terms.txt
147+
cspell1:java/java.txt
148+
cspell1:k8s/k8s.txt
149+
cspell1:latex/latex.txt
150+
cspell1:latex/samples/sample-words.txt
151+
cspell1:lisp/lisp.txt
152+
cspell1:lorem-ipsum/dictionary.txt
153+
cspell1:lua/lua.txt
154+
cspell1:mnemonics/mnemonics.txt
155+
cspell1:monkeyc/monkeyc_keywords.txt
156+
cspell1:node/node.txt
157+
cspell1:npm/npm.txt
158+
cspell1:php/php.txt
159+
cspell1:powershell/powershell.txt
160+
cspell1:public-licenses/generated/public-licenses.txt
161+
cspell1:python/additional_words.txt
162+
cspell1:python/common/extra.txt
163+
cspell1:python/python/python-lib.txt
164+
cspell1:python/python/python.txt
165+
cspell1:r/r.txt
166+
cspell1:redis/redis.txt
167+
cspell1:ruby/ruby.txt
168+
cspell1:rust/rust.txt
169+
cspell1:scala/scala.txt
170+
cspell1:shell/shell-all-words.txt
171+
cspell1:software-terms/software-terms.txt
172+
cspell1:software-terms/webServices.txt
173+
cspell1:sql/sql.txt
174+
cspell1:sql/tsql.txt
175+
cspell1:svelte/svelte.txt
176+
cspell1:swift/swift.txt
177+
cspell1:typescript/typescript.txt
178+
extra_dictionaries: |
179+
cspell1:software-terms/softwareTerms.txt
180+
181+
comment-push:
182+
name: Report (Push)
183+
# If your workflow isn't running on push, you can remove this job
184+
runs-on: ubuntu-latest
185+
needs: spelling
186+
permissions:
187+
actions: read
188+
contents: write
189+
if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push'
190+
steps:
191+
- name: comment
192+
uses: check-spelling/check-spelling@prerelease
193+
with:
194+
checkout: true
195+
spell_check_this: check-spelling/spell-check-this@prerelease
196+
task: ${{ needs.spelling.outputs.followup }}
197+
198+
comment-pr:
199+
name: Report (PR)
200+
# If you workflow isn't running on pull_request*, you can remove this job
201+
runs-on: ubuntu-latest
202+
needs: spelling
203+
permissions:
204+
actions: read
205+
contents: read
206+
pull-requests: write
207+
if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request')
208+
steps:
209+
- name: comment
210+
uses: check-spelling/check-spelling@prerelease
211+
with:
212+
checkout: true
213+
spell_check_this: check-spelling/spell-check-this@prerelease
214+
task: ${{ needs.spelling.outputs.followup }}
215+
experimental_apply_changes_via_bot: 1
216+
217+
update:
218+
name: Update PR
219+
permissions:
220+
contents: write
221+
pull-requests: write
222+
actions: read
223+
runs-on: ubuntu-latest
224+
if: ${{
225+
github.event_name == 'issue_comment' &&
226+
github.event.issue.pull_request &&
227+
contains(github.event.comment.body, '@check-spelling-bot apply') &&
228+
contains(github.event.comment.body, 'https://')
229+
}}
230+
concurrency:
231+
group: spelling-update-${{ github.event.issue.number }}
232+
cancel-in-progress: false
233+
steps:
234+
- name: apply spelling updates
235+
uses: check-spelling/check-spelling@prerelease
236+
with:
237+
experimental_apply_changes_via_bot: 1
238+
checkout: true
239+
ssh_key: "${{ secrets.CHECK_SPELLING }}"

0 commit comments

Comments
 (0)