| Philip Zeyliger | 4de80d2 | 2025-04-23 12:33:31 -0700 | [diff] [blame] | 1 | name: Code Formatting |
| 2 | on: |
| 3 | workflow_call: |
| 4 | push: |
| 5 | branches-ignore: |
| 6 | - "queue-main-**" |
| 7 | pull_request: |
| 8 | |
| 9 | jobs: |
| 10 | formatting: |
| 11 | runs-on: ubuntu-latest |
| 12 | steps: |
| 13 | - uses: actions/checkout@v4 |
| 14 | |
| 15 | # Setup for Prettier |
| 16 | - name: Setup Node.js |
| 17 | uses: actions/setup-node@v4 |
| 18 | with: |
| 19 | node-version: '20' |
| 20 | cache: 'npm' |
| Philip Zeyliger | 2032b1c | 2025-04-23 19:40:42 -0700 | [diff] [blame] | 21 | cache-dependency-path: webui/package-lock.json |
| Philip Zeyliger | 4de80d2 | 2025-04-23 12:33:31 -0700 | [diff] [blame] | 22 | |
| 23 | - name: Install dependencies |
| Philip Zeyliger | 2032b1c | 2025-04-23 19:40:42 -0700 | [diff] [blame] | 24 | working-directory: ./webui |
| Philip Zeyliger | 4de80d2 | 2025-04-23 12:33:31 -0700 | [diff] [blame] | 25 | run: npm ci |
| 26 | |
| 27 | - name: Check Prettier formatting |
| Philip Zeyliger | 2032b1c | 2025-04-23 19:40:42 -0700 | [diff] [blame] | 28 | working-directory: ./webui |
| Philip Zeyliger | 4de80d2 | 2025-04-23 12:33:31 -0700 | [diff] [blame] | 29 | run: npx prettier --check . |
| 30 | |
| 31 | # Setup for gofumpt |
| 32 | - name: Setup Go |
| 33 | uses: actions/setup-go@v4 |
| 34 | with: |
| 35 | go-version: stable |
| 36 | cache: true |
| 37 | |
| 38 | - name: Install gofumpt v0.8.0 |
| 39 | run: | |
| 40 | go install mvdan.cc/gofumpt@v0.8.0 |
| 41 | echo "$(go env GOPATH)/bin" >> $GITHUB_PATH |
| 42 | |
| 43 | - name: Check Go formatting |
| 44 | run: gofumpt -l . | grep . && { echo "Go files need formatting"; exit 1; } || echo "Go formatting check passed" |