-
Notifications
You must be signed in to change notification settings - Fork 18
75 lines (67 loc) · 2.59 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
66
67
68
69
70
71
72
73
74
75
name: Check Spelling
on:
pull_request:
branches:
- main
- feature/*
- spelling/*
paths:
- docs/**
- "*.md"
- .github/components/dictionary.txt
workflow_dispatch:
schedule:
- cron: "0 0 15 * *" # 15th of every month at midnight
concurrency:
# only one run per branch at a time
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
spellcheck:
runs-on: ubuntu-latest
if: github.repository_owner == 'AlexsLemonade'
name: Spell check files
permissions:
contents: read
issues: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Spell check action
uses: alexslemonade/spellcheck@v0
id: spell
with:
dictionary: .github/components/dictionary.txt
# for pull requests, only checks docs and root markdown files, unless the branch triggering is a 'spelling/' branch
# all other triggers (including 'spelling/'' branches) check all files
files: ${{ (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'spelling/')) && 'docs/* docs/*/* docs/*/*/* *.md' || null }}
- name: Upload spell check errors
uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: spell_check_errors
path: spell_check_errors.tsv
- name: Update template
if: ${{ github.event_name != 'pull_request' && steps.spell.outputs.error_count > 0 }}
env:
ERROR_COUNT: ${{ steps.spell.outputs.error_count }}
ARTIFACT_URL: ${{ steps.artifact-upload-step.outputs.artifact-url }}
run: |
sed -i "s@{{ERROR_COUNT}}@${ERROR_COUNT}@g" .github/cron-issue-templates/spellcheck-issue-template.md
sed -i "s@{{ARTIFACT_URL}}@${ARTIFACT_URL}@g" .github/cron-issue-templates/spellcheck-issue-template.md
- name: Post issue with spellcheck results
if: ${{ github.event_name != 'pull_request' && steps.spell.outputs.error_count > 0 }}
id: spellissue
uses: peter-evans/create-issue-from-file@v5
with:
title: Monthly spellcheck results
content-filepath: .github/cron-issue-templates/spellcheck-issue-template.md
labels: |
OpenScPCA admin
spelling
- name: Fail if there are spelling errors for non-scheduled jobs
if: github.event_name != 'schedule' && steps.spell.outputs.error_count > 0
run: |
echo "There were ${{ steps.spell.outputs.error_count }} errors"
column -t spell_check_errors.tsv
exit 1