diff --git a/.github/workflows/whitespace.yml b/.github/workflows/whitespace.yml index 46088d3d351c750b0527d7847e64cf8daecdcc8b..93c1a41b07f3d6a9659856b01452cfcee59b0d5d 100644 --- a/.github/workflows/whitespace.yml +++ b/.github/workflows/whitespace.yml @@ -7,8 +7,22 @@ on: jobs: whitespace: + defaults: + run: + shell: bash runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - - uses: andreasabel/fix-whitespace-action@v1 + + + - run: | + # no longer using the action because apparently we're supposed to use the Makefile here + wget -q https://github.com/agda/fix-whitespace/releases/download/v0.1/fix-whitespace-0.1-linux.binary + mkdir -p "$HOME/.local/bin" + mv fix-whitespace-0.1-linux.binary "$HOME/.local/bin/fix-whitespace" + chmod +x "$HOME/.local/bin/fix-whitespace" + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - run: make whitespace diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2049b97852876d1acaa85442832866d8e3c947c4..c02af86e8723f49baca7f60b96fb2c1dcc50202b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -191,7 +191,9 @@ Whitespace Conventions We use automated whitespace convention checking. Violations can be fixed by running [fix-whitespace](https://hackage.haskell.org/package/fix-whitespace). If -you push a fix of a whitespace violation, please do so in a _separate commit_. +you push a fix of a whitespace violation, please do so in a _separate commit_. For convenience, +`make whitespace` will show violations and `make fix-whitespace` will fix them, if the +`fix-whitespace` utility is installed. Other Conventions ----------------- diff --git a/Makefile b/Makefile index 4fd3d14c29102c1dc1bb331bf6e9a67e97a4c8a6..e995e9e4937f0b1b3b4f388ae9e047f88764e7ff 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,14 @@ style-commit: ## Run the code styler on the previous commit @git diff --name-only HEAD $(COMMIT) Cabal Cabal-syntax cabal-install \ | grep '.hs$$' | xargs -P $(PROCS) -I {} fourmolu -q -i {} +.PHONY: whitespace +whitespace: ## Run fix-whitespace in check mode + fix-whitespace --check --verbose + +.PHONY: fix-whitespace +fix-whitespace: ## Run fix-whitespace in fix mode + fix-whitespace --verbose + # source generation: SPDX SPDX_LICENSE_HS:=Cabal-syntax/src/Distribution/SPDX/LicenseId.hs