edits #22
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: Check Spelling | |
on: | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
pull_request_target: | |
branches: | |
- '**' | |
types: | |
- opened | |
- reopened | |
- synchronize | |
jobs: | |
spelling: | |
name: Check Spelling | |
permissions: | |
contents: read | |
pull-requests: read | |
actions: read | |
security-events: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install check-spelling | |
run: | | |
python -m pip install --upgrade pip | |
pip install check-spelling | |
- name: Run spell check | |
run: | | |
check-spelling \ | |
--config .github/actions/spelling/check-spelling.yml \ | |
--exclude .github/actions/spelling/excludes.txt \ | |
--allow .github/actions/spelling/allow.txt \ | |
--patterns .github/actions/spelling/patterns.txt \ | |
--dictionaries cspell:software-terms/dict/softwareTerms.txt \ | |
--output .github/spellcheck-results.json \ | |
--report-timing \ | |
--warnings bad-regex,binary-file,deprecated-feature,large-file,limited-references,no-newline-at-eof,noisy-file,non-alpha-in-dictionary,token-is-substring,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration,no-files-to-check | |
- name: Upload spell check results | |
if: success() || failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: spellcheck-results | |
path: .github/spellcheck-results.json | |
comment-pr: | |
name: Comment PR | |
runs-on: ubuntu-latest | |
needs: spelling | |
permissions: | |
contents: read | |
pull-requests: write | |
if: success() || failure() | |
steps: | |
- name: Comment on PR with results | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const fs = require('fs'); | |
const results = JSON.parse(fs.readFileSync('.github/spellcheck-results.json', 'utf8')); | |
const issueComment = `Spell check results:\n\n${results.issues.map(issue => `- ${issue.file}: ${issue.message}`).join('\n')}`; | |
await github.rest.issues.createComment({ | |
...context.repo, | |
issue_number: context.issue.number, | |
body: issueComment, | |
}); |