From 5003b1db903a4737dc81bf224cc90bb5ed73494a Mon Sep 17 00:00:00 2001 From: Alex Biehl Date: Tue, 28 May 2024 11:53:33 +0200 Subject: [PATCH] Lint workflow --- .github/workflows/lint.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..0e5b10a --- /dev/null +++ b/.github/workflows/lint.yml @@ -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 \ No newline at end of file