generated from austenstone/action-typescript
-
-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (60 loc) · 2.22 KB
/
spellcheck.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Spell Check .md
on:
workflow_call:
env:
JSON_FILE: spell-check.json
DICTIONARY_FILE: .github/dictionary.txt
jobs:
spellcheck:
name: Check Spelling
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run && github.event.workflow_run.conclusion == 'success' || 1 }}
steps:
- uses: actions/checkout@v3
- name: Get Changed Files
id: changed-files
uses: tj-actions/[email protected]
with:
base_sha: ${{ github.event.pull_request.base.sha }}
files: |
**/*.md
- name: Get File Input
id: files
run: |
if ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}; then
echo "::set-output name=files::${{ steps.changed-files.outputs.all_changed_files }}"
else
echo "::set-output name=files::**/*.md"
fi
echo "${{ steps.files.outputs.files }}"
- name: Check for Dictionary
id: check_files
uses: andstor/file-existence-action@v1
with:
files: ".github/dictionary.txt"
- name: Create Dictionary
if: steps.check_files.outputs.files_exists == 'false'
run: touch ".github/dictionary.txt"
- name: Run spellchecker-cli
id: spellchecker-cli
if: ${{ steps.files.outputs.files }}
continue-on-error: true
run: |
npx -y spellchecker-cli --files ${{ steps.files.outputs.files }} \
--dictionaries $DICTIONARY_FILE \
--ignore "[.0-9]+([Kk][Bb]|[Mm][Bb]|[Gg][Bb])" \
--ignore "\b[Ff][0-9]+('?s)?\b" \
--ignore "\b[Qq][0-4]\b" \
--ignore "\b[Vv][.0-9]\b" \
--ignore "\b[Vv]?(\d+\.)?(\d+\.)?(\*|\d+)\b" \
--plugins spell indefinite-article repeated-words syntax-mentions syntax-urls \
--reports $JSON_FILE
- name: Upload JSON Artifact
uses: actions/upload-artifact@v3
if: ${{ steps.spellchecker-cli.conclusion == 'success' }}
with:
path: ${{ env.JSON_FILE }}
- name: Create Output
uses: austenstone/spellchecker-cli-action-summary@main
with:
files-changed: ${{ steps.changed-files.outputs.all_changed_files }}