forked from yandex-cloud/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic CSpell config with GitHub action (#2)
* add basic cspell config with gh action * move gh action to the right folder * move gh action to the right folder
- Loading branch information
1 parent
486411b
commit 78b3425
Showing
8 changed files
with
2,505 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
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 PR diff | ||
id: pr_diff | ||
run: | | ||
PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') | ||
git fetch origin pull/$PR_NUMBER/head:pr-$PR_NUMBER | ||
echo "PR_DIFF<<EOF" >> $GITHUB_OUTPUT | ||
git diff --name-only origin/${{ github.base_ref }} pr-$PR_NUMBER >> $GITHUB_OUTPUT | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
- 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: Download latest SDD dictionary | ||
run: | | ||
REPO="AlexJameson/software-development-dictionary-ru" | ||
LATEST_RELEASE=$(curl -s https://api.github.com/repos/$REPO/releases/latest) | ||
DOWNLOAD_URL=$(echo $LATEST_RELEASE | grep -o '"browser_download_url": "[^"]*sdd.txt"' | cut -d '"' -f 4) | ||
if [ -n "$DOWNLOAD_URL" ]; then | ||
curl -L -o sdd.txt "$DOWNLOAD_URL" | ||
echo "Downloaded sdd.txt from latest release" | ||
else | ||
echo "Error: Could not find sdd.txt in the latest release" | ||
exit 1 | ||
fi | ||
- name: Run CSpell | ||
run: | | ||
CHANGED_FILES="${{ steps.pr_diff.outputs.PR_DIFF }}" | ||
echo "Files to check:" | ||
echo "$CHANGED_FILES" | ||
echo "Running CSpell..." | ||
cspell --config ./cspell.json \ | ||
--dictionaries cspell-dicts/internal.txt,cspell-dicts/forbidden-en.txt,cspell-dicts/forbidden-ru.txt,cspell-dicts/allowed-en.txt,cspell-dicts/allowed-ru.txt,cspell-dicts/sdd.txt \ | ||
--show-context \ | ||
$CHANGED_FILES | ||
continue-on-error: true | ||
|
||
- name: Comment PR | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'CSpell check completed. Please check the action logs for results.' | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
preemptible |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
донастроить |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
!Функционал | ||
!функционал |
Empty file.
Oops, something went wrong.