Skip to content

Commit

Permalink
fix(ci/spellcheck): create a new issue every week
Browse files Browse the repository at this point in the history
  • Loading branch information
OnkarRuikar committed Sep 9, 2024
1 parent a3f3d02 commit 6cf6bfb
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/spelling-check-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ jobs:
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
if [ -n "${output}" ]; then
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
else
echo "No typos found! 🎉"
fi
- name: Report spellcheck errors
if: env.OUTPUT != ''
Expand All @@ -43,14 +47,18 @@ jobs:
> 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'))_")
# create a new issue
# https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#create-an-issue
gh api \
--method PATCH \
--method POST \
-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}"
/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 }}

0 comments on commit 6cf6bfb

Please sign in to comment.