Check the quality of your Elm code using elm-review in a GitHub workflow - any reports found will be added as annotations on your files.
This view shows in your pull request checks or repository actions. You can see a working example of some failed checks.
This is the view of "files changed" in a pull request with the elm-review annotations shown inline. Errors can show up in files even if you didn't change them in the pull request, as they could be a side effect of your changes.
This action uses the GitHub Checks API. You will need a token with the write checks permission. You can do this for the whole workflow or per-job.
permissions:
checks: write
You must have elm-review
, elm-format
and the elm
compiler available in your build, here is an example using $GITHUB_PATH
for when they're all dependencies in package.json
.
jobs:
lint:
permissions:
checks: write
steps:
- uses: actions/checkout@v2
- run: yarn --frozen-lockfile
- name: Add elm-review, elm and elm-format to path
run: yarn bin >> $GITHUB_PATH
- uses: sparksp/elm-review-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# elm_review: elm-review
# elm_format: elm-format
# elm_compiler: elm
The default options are probably sufficient for most people's needs, however we understand that your set up may be different. You can use the options details below to specify the paths for elm-review
, elm-format
and the elm
compiler; to locate your project's elm.json
or review/
folder, and to specify a custom list of files to review. You can also customise the check name that shows up.
This snippet shows an example of what the option defaults are like, however there's more going on behind the scenes to establish the proper default for some values.
- uses: sparksp/elm-review-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# name: elm-review
# elm_review: elm-review
# elm_compiler: elm
# elm_format: elm-format
# elm_review_config: review
# elm_json: elm.json
# elm_files: |
# src/
# tests/
# working-directory: ./
This action creates its own entry in the checks called "elm-review", you can change the check name shown with this input.
Specify the path to elm-review
.
Specify the path to the elm
compiler.
Specify the path to elm-format
.
Use the review/
configuration in the specified directory instead of the one found in the current directory or one of its parents.
Specify the path to the elm.json file of the project. By default, the one in the current directory or its parent directories will be used.
List of Elm files or directories you wish to review. Unless files or directories are specified, elm-review
will look at:
- For packages:
src/
andtests/
- For applications: the
source-directories
in the project'selm.json
andtests/
Optional working directory, defaults to the current directory.