forked from yandex-cloud/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (57 loc) · 2.09 KB
/
spellcheck-ru.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
name: CSpell Check
on:
issue_comment:
types: [created]
jobs:
spellcheck:
if: github.event.issue.pull_request && github.event.comment.body == '/check-ru'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get pull request
id: get-pr
uses: xt0rted/pull-request-comment-branch@v2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
with:
base_sha: ${{ steps.get-pr.outputs.base_sha }}
sha: ${{ steps.get-pr.outputs.head_sha }}
- name: Print PR outputs
run: |
echo "Base SHA: ${{ steps.get-pr.outputs.base_sha }}"
echo "Head SHA: ${{ steps.get-pr.outputs.head_sha }}"
echo "Base ref: ${{ steps.get-pr.outputs.base_ref }}"
echo "Head ref: ${{ steps.get-pr.outputs.head_ref }}"
echo "Head ref: ${{ steps.changed-files.outputs.all_changed_files }}"
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install CSpell and dictionaries
run: |
npm install -g cspell
npm install -g @cspell/dict-ru_ru
cspell link add @cspell/dict-ru_ru
npm install -g @cspell/dict-en-common-misspellings
cspell link add @cspell/dict-en-common-misspellings
- name: Run CSpell on changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
cspell_output=""
for file in ${ALL_CHANGED_FILES}; do
echo "Running CSpell on $file..."
file_content=$(cat $file)
cspell_errors=$(echo "$file_content" | cspell --config ./cspell.json --debug)
if [ -n "$cspell_errors" ]; then
cspell_output+="CSpell errors in $file:\n$cspell_errors\n\n"
fi
done
echo "CSpell output:"
echo "$cspell_output"
echo "::set-output name=cspell_output::$cspell_output"
id: cspell
continue-on-error: true