Skip to content

Commit

Permalink
use offical way
Browse files Browse the repository at this point in the history
  • Loading branch information
OnkarRuikar committed Sep 9, 2024
1 parent 6cf6bfb commit d66cbed
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions .github/workflows/spelling-check-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
sync:
if: github.repository == 'mdn/content'
runs-on: ubuntu-latest
permissions:
issues: write

steps:
- uses: actions/checkout@v4
Expand All @@ -21,7 +23,6 @@ jobs:

- name: Run scripts
run: |
npm install
echo Running spelling check...
output=$(npx cspell --no-progress --gitignore --config .vscode/cspell.json "**/*.md" || exit 0)
if [ -n "${output}" ]; then
Expand All @@ -38,27 +39,16 @@ jobs:
- name: Report spellcheck errors
if: env.OUTPUT != ''
run: |
comment_body=$(cat<<EOM
Typos and unknown words:
${OUTPUT}
issue=$(gh issue create --title "$TITLE" --label "$LABELS" --body "$BODY")
echo Issue URL ${issue}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TITLE: Weekly spelling check
LABELS: reported by automation,good first issue
BODY: |
Typos and unknown words:
> [!TIP]
> To exclude words from the spellchecker, you can add valid words (web technology terms or abbreviations) to the [terms-abbreviations.txt](https://github.com/mdn/content/blob/main/.vscode/terms-abbreviations.txt) dictionary for IDE autocompletion. To ignore strings that are not words (\`AABBCC\` in code, for instance), you can add them to [ignore-list.txt](https://github.com/mdn/content/blob/main/.vscode/ignore-list.txt).
EOM
)
${{ env.OUTPUT }}
# create a new issue
# https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#create-an-issue
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/mdn/content/issues \
-f "title=Weekly spelling check" \
-f "body=${comment_body}" \
-f "labels[]=reported by automation" \
-f "labels[]=good first issue"
env:
OUTPUT: ${{ env.OUTPUT }}
GH_TOKEN: ${{ github.token }}
> [!TIP]
> To exclude words from the spellchecker, you can add valid words (web technology terms or abbreviations) to the [terms-abbreviations.txt](https://github.com/mdn/content/blob/main/.vscode/terms-abbreviations.txt) dictionary for IDE autocompletion. To ignore strings that are not words (\`AABBCC\` in code, for instance), you can add them to [ignore-list.txt](https://github.com/mdn/content/blob/main/.vscode/ignore-list.txt).

0 comments on commit d66cbed

Please sign in to comment.