Skip to content

Commit

Permalink
Lint workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbiehl committed May 28, 2024
1 parent 588cade commit 448157d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Lint

# Trigger the workflow on push or pull request, but only for the master branch
on:
pull_request:
push:
branches: [master]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- name: Check code is formatted using Ormolu
run: |
curl -L https://github.com/tweag/ormolu/releases/download/0.7.2.0/ormolu-Linux.zip -o ormolu.zip
unzip ormolu.zip
git ls-files | grep -v 'example/' | grep \.hs | xargs ./ormolu --mode=inplace
if [[ $(git diff --stat) != '' ]]; then
echo "Lint stage failed, running ormolu has returned changes"
echo "$(git diff)"
exit 1
else
echo "Lint stage succeeded"
exit 0
fi
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ Y ou can install the executable with using:
$ cabal install .
```

## Formatting

To pass the lint workflow run

```
$ git ls-files | grep -v 'example/' | grep \.hs | xargs ./ormolu --mode=inplace
```

to format the Haskell files accordingly using Ormolu.

## Community & Contact

Feel free to join on us on our
Expand Down

0 comments on commit 448157d

Please sign in to comment.