Add sample file with mistakes #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CSpell Check | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
spellcheck: | |
if: github.event.comment.body == '/check-ru' && github.event.issue.pull_request != null | |
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 | |
run: | | |
changed_files=$(git diff --name-only ${{ steps.get-pr.outputs.base_sha }}..${{ steps.get-pr.outputs.head_sha }}) | |
echo "::set-output name=all_changed_files::${changed_files}" | |
- name: Print PR outputs | |
run: | | |
echo "Changed: ${{ steps.changed-files.outputs.all_changed_files }}" | |
echo "Current working directory: $(pwd)" | |
- name: Find file | |
run: | | |
find . -name sample.md | |
- 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 }} | |
GITHUB_WORKSPACE: ${{ github.workspace }} | |
run: | | |
cspell_output="" | |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
echo "Running CSpell on $file..." | |
file_path="${GITHUB_WORKSPACE}/${file}" | |
file_content=$(cat "${file_path}") | |
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 |