Skip to content

Commit

Permalink
Merge pull request #13 from AlexsLemonade/sjspielman/update-spellcheck
Browse files Browse the repository at this point in the history
Update spellcheck
  • Loading branch information
sjspielman authored May 23, 2024
2 parents 9c052bf + 94b61c0 commit 8262d22
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 60 deletions.
57 changes: 31 additions & 26 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,47 @@
name: Spell check R Markdown and Markdown files

name: Spell check Markdown files

# Controls when the action will run.
# Pull requests to main only.
on:
pull_request:
branches:
- main

concurrency:
# only one run per branch at a time
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# This workflow contains a single job called "spell check"
spell-check:
spellcheck:
runs-on: ubuntu-latest
container:
image: rocker/tidyverse:4.2.3
name: Spell check files
permissions:
contents: read
issues: write

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3

- name: Install packages
run: Rscript --vanilla -e "install.packages(c('spelling'), repos = c(CRAN = '$CRAN'))"
- name: Checkout
uses: actions/checkout@v4

- name: Run spell check
id: spell_check_run
- name: Remove files that do not need to be spellchecked
run: |
results=$(Rscript --vanilla "scripts/spell-check.R")
echo "sp_chk_results=$results" >> $GITHUB_OUTPUT
cat spell_check_errors.tsv
rm ./LICENSE.md
- name: Archive spelling errors
uses: actions/upload-artifact@v3
if: ${{ steps.spell_check_run.outputs.sp_chk_results > 0 }}
- name: Spell check action
uses: alexslemonade/spellcheck@v0
id: spell
with:
name: spell-check-results
dictionary: components/dictionary.txt

- name: Upload spell check errors
uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: spell_check_errors
path: spell_check_errors.tsv

# If there are too many spelling errors, this will stop the workflow
- name: Check spell check results - fail if too many errors
if: ${{ steps.spell_check_run.outputs.sp_chk_results > 0 }}
run: exit 1
- name: Fail if there are spelling errors
if: steps.spell.outputs.error_count > 0
run: |
echo "There were ${{ steps.spell.outputs.error_count }} errors"
column -t spell_check_errors.tsv
exit 1
1 change: 1 addition & 0 deletions components/dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
⚠️
ableist
al
Alevin
Expand Down
34 changes: 0 additions & 34 deletions scripts/spell-check.R

This file was deleted.

0 comments on commit 8262d22

Please sign in to comment.