Skip to content

Commit 92fc2d4

Browse files
committed
Add check-spelling
0 parents  commit 92fc2d4

File tree

1 file changed

+241
-0
lines changed

1 file changed

+241
-0
lines changed

.github/workflows/spelling.yml

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

0 commit comments

Comments
 (0)