Skip to content

Create an issue to report typos #3

Create an issue to report typos

Create an issue to report typos #3

name: Create an issue to report typos
on:
schedule:
- cron: "0 0 * * mon"
workflow_dispatch:
jobs:
sync:
if: github.repository == 'mdn/content'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn
- name: Run scripts
run: |
npm install
echo Running spelling check...
output=$(npx cspell --no-progress --gitignore --config .vscode/cspell.json "**/*.md" || exit 0)
output=$(node scripts/linkify-logs.js "${output}")
output=$(echo "$output" | sed 's/^/- /')
echo "$output"
echo "OUTPUT<<EOF" >> $GITHUB_ENV
echo "$output" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Report spellcheck errors
if: env.OUTPUT != ''
run: |
comment_body=$(cat<<EOM
Typos and unknown words:
${OUTPUT}
> [!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
)
comment_body+=$'\n\n'$(echo "_(comment last updated: $(date +'%Y-%m-%d %H:%M:%S'))_")
gh api \
--method PATCH \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/mdn/content/issues/35634 \
-f "state=open" \
-f "body=${comment_body}"
env:
OUTPUT: ${{ env.OUTPUT }}
GH_TOKEN: ${{ github.token }}