Skip to content

Commit 681aae1

Browse files
committed
Improvements to spell checker action based on official example
Allow posting comments etc.
1 parent d5cefbd commit 681aae1

File tree

1 file changed

+73
-21
lines changed

1 file changed

+73
-21
lines changed

.github/workflows/spelling.yaml

Lines changed: 73 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,82 @@
11
name: Check Spelling
22

3+
# Based on example in https://github.com/check-spelling/spell-check-this.
4+
35
on:
4-
pull_request:
6+
push:
7+
pull_request_target:
8+
branches:
9+
- "**"
10+
types:
11+
- 'opened'
12+
- 'reopened'
13+
- 'synchronize'
14+
issue_comment:
15+
types:
16+
- 'created'
517

618
jobs:
719
spelling:
820
name: Check Spelling
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
actions: read
25+
security-events: write
26+
outputs:
27+
followup: ${{ steps.spelling.outputs.followup }}
28+
runs-on: ubuntu-latest
29+
if: ${{ contains(github.event_name, 'pull_request') || github.event_name == 'push' }}
30+
concurrency:
31+
group: spelling-${{ github.event.pull_request.number || github.ref }}
32+
cancel-in-progress: true
33+
steps:
34+
- name: check-spelling
35+
id: spelling
36+
uses: check-spelling/check-spelling@prerelease
37+
with:
38+
suppress_push_for_open_pull_request: ${{ github.actor != 'dependabot[bot]' && 1 }}
39+
checkout: true
40+
check_file_names: 1
41+
post_comment: 1
42+
use_magic_file: 1
43+
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
44+
use_sarif: ${{ (!github.event.pull_request || (github.event.pull_request.head.repo.full_name == github.repository)) && 1 }}
45+
extra_dictionary_limit: 20
46+
extra_dictionaries:
47+
cspell:software-terms/dict/softwareTerms.txt
48+
cspell:bash/dict/bash-words.txt
49+
cspell:companies/dict/companies.txt
50+
cspell:filetypes/filetypes.txt
51+
52+
comment-push:
53+
name: Report (Push)
54+
# If your workflow isn't running on push, you can remove this job
55+
runs-on: ubuntu-latest
56+
needs: spelling
57+
permissions:
58+
contents: write
59+
if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push'
60+
steps:
61+
- name: comment
62+
uses: check-spelling/check-spelling@prerelease
63+
with:
64+
checkout: true
65+
spell_check_this: check-spelling/spell-check-this@prerelease
66+
task: ${{ needs.spelling.outputs.followup }}
67+
68+
comment-pr:
69+
name: Report (PR)
970
runs-on: ubuntu-latest
71+
needs: spelling
72+
permissions:
73+
contents: read
74+
pull-requests: write
75+
if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request')
1076
steps:
11-
- uses: actions/checkout@v3
12-
- name: Check spelling
13-
id: spelling
14-
# The given commit contains preliminary, unreleased, support for ignoring
15-
# whole blocks (multi-line) from spell checking. See
16-
# https://github.com/check-spelling/check-spelling/commit/46c981b7c96b3777aff4fd711fc9a8f126121b04
17-
# for more details.
18-
uses: check-spelling/check-spelling@46c981b7c96b3777aff4fd711fc9a8f126121b04
19-
with:
20-
check_file_names: 1
21-
post_comment: 0
22-
use_magic_file: 1
23-
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
24-
use_sarif: 1
25-
extra_dictionary_limit: 20
26-
extra_dictionaries:
27-
cspell:software-terms/dict/softwareTerms.txt
28-
cspell:bash/dict/bash-words.txt
29-
cspell:companies/dict/companies.txt
30-
cspell:filetypes/filetypes.txt
77+
- name: comment
78+
uses: check-spelling/check-spelling@prerelease
79+
with:
80+
checkout: true
81+
spell_check_this: check-spelling/spell-check-this@prerelease
82+
task: ${{ needs.spelling.outputs.followup }}

0 commit comments

Comments
 (0)