docs: add CONTRIBUTING.md with development and PR workflow guide (#389) #2791
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: fourmolu | |
| on: push | |
| jobs: | |
| format: | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache fourmolu | |
| id: cache-fourmolu | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.local/bin/fourmolu | |
| key: fourmolu-0.19.0.0 | |
| - name: Install fourmolu | |
| if: steps.cache-fourmolu.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p ~/.local/bin | |
| curl -sL https://github.com/fourmolu/fourmolu/releases/download/v0.19.0.0/fourmolu-0.19.0.0-linux-x86_64 -o ~/.local/bin/fourmolu | |
| chmod +x ~/.local/bin/fourmolu | |
| - name: Add fourmolu to PATH | |
| run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Format code | |
| run: make fmt | |
| - name: Commit formatted code | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add -A | |
| git diff --staged --quiet || git commit -m "Auto-format code with fourmolu" | |
| - name: Push changes | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref }} |