-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add usage to readme and test image #5
Changes from all commits
7c537af
a92dc81
ca4220a
ad53979
d6c7613
4cd0d0b
31d6854
c500ca0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ on: | |
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: | ||
- main | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,51 @@ | ||
# spellcheck | ||
|
||
This repository contains a Docker image with the [R `spelling` package](https://cran.r-project.org/web/packages/spelling/index.html) installed. | ||
The role of this repository is to facilitate spell checking actions across `AlexsLemonade` repositories. | ||
This repository contains a GitHub action to run the [R `spelling` package](https://cran.r-project.org/web/packages/spelling/index.html). | ||
The role of this action is to facilitate spell checking actions across `AlexsLemonade` repositories. | ||
|
||
speeling | ||
Currently the action will only spell check text in Rmd and md files | ||
|
||
## Usage | ||
|
||
To use this action, create a `.github/workflows/spellcheck.yml` file in your repository with the following contents (modified to fit your exact needs): | ||
|
||
```yaml | ||
name: Check Spelling | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
spell-check: | ||
runs-on: ubuntu-latest | ||
name: Spell check files | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Spell check action | ||
uses: alexslemonade/spellcheck | ||
id: spell | ||
with: | ||
dictionary: components/dictionary.txt | ||
|
||
- name: Upload spell check errors | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: spell_check_errors | ||
path: spell_check_errors.tsv | ||
|
||
- name: Fail if there are spelling errors | ||
if: steps.spell.outputs.error_count > 0 | ||
run: | | ||
echo "There were ${{ steps.spell.outputs.error_count }} errors" | ||
exit 1 | ||
``` | ||
|
||
Note that the `dictionary` input to the spell check step is optional and defaults to `components/dictionary.txt`. | ||
If you want to use a different dictionary, you can specify the path to the dictionary file in your repository. | ||
|
||
You can also specify specific files to spell check using the `files` input to the `alexslemonade/spellcheck` step. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This did not work as expected: https://github.com/sjspielman/test-spellcheck/pull/2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But if you pass in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect this to be handled by the fact that the arguments are named in the context of the action. So I added a fix in case an empty string is given, but if you use
I would expect the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I did not test this actually - this is just my sense of looking at the R code directly. Let me check formally.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Confirmed, as expected! |
||
Globs should work as expected. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
# action.yml | ||
name: 'R spell check' | ||
description: 'Spell check R, Rmd and md files' | ||
name: "R spell check" | ||
description: "Spell check R, Rmd and md files" | ||
inputs: | ||
dictionary: # id of input | ||
description: 'Dictionary file path' | ||
dictionary: # id of input | ||
description: "Dictionary file path" | ||
required: true | ||
default: 'components/dictionary.txt' | ||
default: "components/dictionary.txt" | ||
files: | ||
description: Glob of files to check | ||
required: false | ||
outputs: | ||
error_count: | ||
description: The number of spelling errors | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
using: "docker" | ||
image: ghcr.io/alexslemonade/spellcheck:edge | ||
args: | ||
- ${{ inputs.dictionary }} | ||
- ${{ inputs.dictionary || '/dev/null' }} | ||
- ${{ inputs.files }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As is this does not work because it needs a tag, but it does work with
alexslemonade/spellcheck@main
.Easy enough to pop in when we decide on the tag, which we can do in this PR or after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some fixes, so I think the move is going to be to merge this PR, tag a release, then update a couple things in a new PR.