Skip to content

Commit c592fba

Browse files
committed
Add check-spelling
0 parents  commit c592fba

File tree

1 file changed

+166
-0
lines changed

1 file changed

+166
-0
lines changed

.github/workflows/spelling.yml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
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: 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,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
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+
extra_dictionaries:
109+
cspell:software-terms/dict/softwareTerms.txt
110+
111+
comment-push:
112+
name: Report (Push)
113+
# If your workflow isn't running on push, you can remove this job
114+
runs-on: ubuntu-latest
115+
needs: spelling
116+
permissions:
117+
contents: write
118+
if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push'
119+
steps:
120+
- name: comment
121+
uses: check-spelling/check-spelling@prerelease
122+
with:
123+
checkout: true
124+
spell_check_this: check-spelling/spell-check-this@prerelease
125+
task: ${{ needs.spelling.outputs.followup }}
126+
127+
comment-pr:
128+
name: Report (PR)
129+
# If you workflow isn't running on pull_request*, you can remove this job
130+
runs-on: ubuntu-latest
131+
needs: spelling
132+
permissions:
133+
contents: read
134+
pull-requests: write
135+
if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request')
136+
steps:
137+
- name: comment
138+
uses: check-spelling/check-spelling@prerelease
139+
with:
140+
checkout: true
141+
spell_check_this: check-spelling/spell-check-this@prerelease
142+
task: ${{ needs.spelling.outputs.followup }}
143+
experimental_apply_changes_via_bot: 1
144+
145+
update:
146+
name: Update PR
147+
permissions:
148+
contents: write
149+
pull-requests: write
150+
actions: read
151+
runs-on: ubuntu-latest
152+
if: ${{
153+
github.event_name == 'issue_comment' &&
154+
github.event.issue.pull_request &&
155+
contains(github.event.comment.body, '@check-spelling-bot apply')
156+
}}
157+
concurrency:
158+
group: spelling-update-${{ github.event.issue.number }}
159+
cancel-in-progress: false
160+
steps:
161+
- name: apply spelling updates
162+
uses: check-spelling/check-spelling@prerelease
163+
with:
164+
experimental_apply_changes_via_bot: 1
165+
checkout: true
166+
ssh_key: "${{ secrets.CHECK_SPELLING }}"

0 commit comments

Comments
 (0)