Skip to content

Commit

Permalink
add comments correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexJameson committed Aug 22, 2024
1 parent d3a546e commit dc42452
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/spellcheck-ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,35 @@ jobs:
echo "::set-output name=all_files::$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | tr '\n' ' ')"
- name: Run CSpell on all changed files
id: cspell_check
continue-on-error: true
run: |
output=""
for file in ${{ steps.files.outputs.all_files }}; do
if [ "$file" = ".github/workflows/spellcheck-ru.yml" ] || [ "$file" = "cspell.json" ]; then
echo "Skipping CSpell check for $file"
continue
fi
echo "Checking $file for spelling errors..."
cspell $file --config cspell.json --show-suggestions
done
result=$(cspell "$file" --config cspell.json)
if [ -n "$result" ]; then
output+="### Errors in $file:\n\\\\n$result\n\\\\n\n"
fi
done
echo "::set-output name=results::${output}"
- name: Post results as a PR comment
if: steps.cspell_check.outputs.results != ''
uses: actions/github-script@v5
with:
script: |
const output = ${{ steps.cspell_check.outputs.results }};
const prNumber = context.payload.pull_request.number;
const repoName = context.repo.repo;
const ownerName = context.repo.owner;
github.rest.issues.createComment({
owner: ownerName,
repo: repoName,
issue_number: prNumber,
body: output
});

0 comments on commit dc42452

Please sign in to comment.