elm-format-action/README.md

58 lines
1.6 KiB
Markdown
Raw Normal View History

2020-04-22 12:51:13 +03:00
[![elm-format-action status](https://github.com/sparksp/elm-format-action/workflows/build-test/badge.svg)](https://github.com/sparksp/elm-format-action/actions)
2020-04-20 20:11:39 +03:00
# elm-format --validate
Validate your [Elm] files using [elm-format] - any unformatted files will cause the check to fail and a note will be added to each failing file.
[Elm]: https://elm-lang.org/
[elm-format]: https://github.com/avh4/elm-format
## Finding elm-format
2020-04-20 20:11:39 +03:00
2020-04-22 11:32:03 +03:00
You must have `elm-format` available in your build, here is an example where elm-format is in `package.json`.
2020-04-20 20:11:39 +03:00
```yaml
2020-04-22 11:32:03 +03:00
jobs:
lint:
steps:
- uses: actions/checkout@v2
- run: yarn
2020-04-22 11:44:49 +03:00
- name: Add elm-format to path
2021-01-08 13:59:00 +03:00
run: yarn bin >> $GITHUB_PATH
2020-04-22 17:47:31 +03:00
- uses: sparksp/elm-format-action@v1
2020-04-22 11:32:03 +03:00
with:
2020-04-22 11:44:49 +03:00
# elm_format: elm-format
2020-04-22 11:32:03 +03:00
# elm_files: src/
2020-04-22 16:54:24 +03:00
# elm_glob: false
2020-08-17 18:51:25 +03:00
# working-directory: ./
2020-04-22 16:54:24 +03:00
```
## Multiple Files
To match multiple files or directories, list each on a new line...
```yaml
2020-04-22 17:47:31 +03:00
- uses: sparksp/elm-format-action@v1
2020-04-22 16:54:24 +03:00
with:
elm_files: |
src/Main.elm
src/Wait.elm
tests/
```
## File Glob
This action supports file globs using [@actions/glob]. elm-format will process each file or directory it is given, so take care to match only elm files OR directories with your globs.
```yaml
2020-04-22 17:47:31 +03:00
- uses: sparksp/elm-format-action@v1
2020-04-22 16:54:24 +03:00
with:
# Match all elm files except any TW.elm
elm_files: |
src/**/*.elm
!**/TW.elm
elm_glob: true
```
[@actions/glob]: https://github.com/actions/toolkit/tree/master/packages/glob#patterns