Skip to content

Commit 67e4f5e

Browse files
committed
Add check-spelling
0 parents  commit 67e4f5e

File tree

1 file changed

+253
-0
lines changed

1 file changed

+253
-0
lines changed

.github/workflows/spelling.yml

Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
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.pull_request(_target).edited is only needed for with.check_commit_messages: title | description
60+
61+
on:
62+
push:
63+
branches:
64+
- '**'
65+
tags-ignore:
66+
- '**'
67+
pull_request_target:
68+
branches:
69+
- '**'
70+
types:
71+
- 'edited'
72+
- 'opened'
73+
- 'reopened'
74+
- 'synchronize'
75+
issue_comment:
76+
types:
77+
- 'created'
78+
79+
permissions: {}
80+
81+
jobs:
82+
spelling:
83+
name: Check Spelling
84+
permissions:
85+
contents: read
86+
pull-requests: read
87+
actions: read
88+
security-events: write
89+
outputs:
90+
followup: ${{ steps.spelling.outputs.followup }}
91+
runs-on: ubuntu-latest
92+
if: ${{ contains(github.event_name, 'pull_request') || github.event_name == 'push' }}
93+
concurrency:
94+
group: spelling-${{ github.event.pull_request.number || github.ref }}
95+
# note: If you use only_check_changed_files, you do not want cancel-in-progress
96+
cancel-in-progress: true
97+
steps:
98+
- name: check-spelling
99+
id: spelling
100+
uses: check-spelling/check-spelling@prerelease
101+
with:
102+
suppress_push_for_open_pull_request: ${{ github.actor != 'dependabot[bot]' && 1 }}
103+
checkout: true
104+
check_file_names: 1
105+
check_commit_messages: commits, title, description
106+
spell_check_this: check-spelling/spell-check-this@prerelease
107+
post_comment: 0
108+
use_magic_file: 1
109+
report-timing: 1
110+
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
111+
experimental_apply_changes_via_bot: 1
112+
use_sarif: 1
113+
extra_dictionary_limit: 20
114+
dictionary_source_prefixes: >
115+
{
116+
"asm": "https://raw.githubusercontent.com/check-spelling/assembly-dictionaries/20231110/",
117+
"cspell": "https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/",
118+
"cspell1": "https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20241114/dictionaries/",
119+
"census": "https://raw.githubusercontent.com/check-spelling-sandbox/census/dictionaries-d90e686f89dd241ad61d30f26619e54d73e73c6e/dictionaries/"
120+
}
121+
check_extra_dictionaries: |
122+
asm:amd64-isa.txt
123+
asm:ia64-isa.txt
124+
asm:power-isa.txt
125+
cspell1:ada/ada.txt
126+
cspell1:aws/aws.txt
127+
cspell1:clojure/clojure.txt
128+
cspell1:companies/companies.txt
129+
cspell1:cpp/compiler-clang-attributes.txt
130+
cspell1:cpp/compiler-gcc.txt
131+
cspell1:cpp/compiler-msvc.txt
132+
cspell1:cpp/ecosystem.txt
133+
cspell1:cpp/lang-jargon.txt
134+
cspell1:cpp/lang-keywords.txt
135+
cspell1:cpp/people.txt
136+
cspell1:cpp/stdlib-c.txt
137+
cspell1:cpp/stdlib-cerrno.txt
138+
cspell1:cpp/stdlib-cmath.txt
139+
cspell1:cpp/stdlib-cpp.txt
140+
cspell1:cpp/template-strings.txt
141+
cspell1:cryptocurrencies/cryptocurrencies.txt
142+
cspell1:csharp/csharp.txt
143+
cspell1:css/css.txt
144+
cspell1:dart/dart.txt
145+
cspell1:django/django.txt
146+
cspell1:django/requirements.txt
147+
cspell1:docker/docker-words.txt
148+
cspell1:dotnet/dotnet.txt
149+
cspell1:elixir/elixir.txt
150+
cspell1:filetypes/filetypes.txt
151+
cspell1:fonts/fonts.txt
152+
cspell1:fullstack/fullstack.txt
153+
cspell1:gaming-terms/gaming-terms.txt
154+
cspell1:golang/go.txt
155+
cspell1:haskell/haskell.txt
156+
cspell1:html/html.txt
157+
cspell1:java/java-terms.txt
158+
cspell1:java/java.txt
159+
cspell1:k8s/k8s.txt
160+
cspell1:latex/latex.txt
161+
cspell1:latex/samples/sample-words.txt
162+
cspell1:lisp/lisp.txt
163+
cspell1:lorem-ipsum/dictionary.txt
164+
cspell1:lua/lua.txt
165+
cspell1:mnemonics/mnemonics.txt
166+
cspell1:monkeyc/monkeyc_keywords.txt
167+
cspell1:node/node.txt
168+
cspell1:npm/npm.txt
169+
cspell1:php/php.txt
170+
cspell1:powershell/powershell.txt
171+
cspell1:public-licenses/generated/public-licenses.txt
172+
cspell1:python/additional_words.txt
173+
cspell1:python/common/extra.txt
174+
cspell1:python/python/python-lib.txt
175+
cspell1:python/python/python.txt
176+
cspell1:r/r.txt
177+
cspell1:redis/redis.txt
178+
cspell1:ruby/ruby.txt
179+
cspell1:rust/rust.txt
180+
cspell1:scala/scala.txt
181+
cspell1:shell/shell-all-words.txt
182+
cspell1:software-terms/software-terms.txt
183+
cspell1:software-terms/webServices.txt
184+
cspell1:sql/sql.txt
185+
cspell1:sql/tsql.txt
186+
cspell1:svelte/svelte.txt
187+
cspell1:swift/swift.txt
188+
cspell1:typescript/typescript.txt
189+
census:census-5.txt
190+
census:census-7.txt
191+
census:census-10.txt
192+
extra_dictionaries: |
193+
cspell1:software-terms/softwareTerms.txt
194+
195+
comment-push:
196+
name: Report (Push)
197+
# If your workflow isn't running on push, you can remove this job
198+
runs-on: ubuntu-slim
199+
needs: spelling
200+
permissions:
201+
actions: read
202+
contents: write
203+
if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push'
204+
steps:
205+
- name: comment
206+
uses: check-spelling/check-spelling@prerelease
207+
with:
208+
checkout: true
209+
spell_check_this: check-spelling/spell-check-this@prerelease
210+
task: ${{ needs.spelling.outputs.followup }}
211+
212+
comment-pr:
213+
name: Report (PR)
214+
# If you workflow isn't running on pull_request*, you can remove this job
215+
runs-on: ubuntu-slim
216+
needs: spelling
217+
permissions:
218+
actions: read
219+
contents: read
220+
pull-requests: write
221+
if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request')
222+
steps:
223+
- name: comment
224+
uses: check-spelling/check-spelling@prerelease
225+
with:
226+
checkout: true
227+
spell_check_this: check-spelling/spell-check-this@prerelease
228+
task: ${{ needs.spelling.outputs.followup }}
229+
experimental_apply_changes_via_bot: 1
230+
231+
update:
232+
name: Update PR
233+
permissions:
234+
contents: write
235+
pull-requests: write
236+
actions: read
237+
runs-on: ubuntu-slim
238+
if: ${{
239+
github.event_name == 'issue_comment' &&
240+
github.event.issue.pull_request &&
241+
contains(github.event.comment.body, '@check-spelling-bot apply') &&
242+
contains(github.event.comment.body, 'https://')
243+
}}
244+
concurrency:
245+
group: spelling-update-${{ github.event.issue.number }}
246+
cancel-in-progress: false
247+
steps:
248+
- name: apply spelling updates
249+
uses: check-spelling/check-spelling@prerelease
250+
with:
251+
experimental_apply_changes_via_bot: 1
252+
checkout: true
253+
ssh_key: '${{ secrets.CHECK_SPELLING }}'

0 commit comments

Comments
 (0)