blob: 69d872188d65fa0613e037b35a1735ef64d96a9f [file] [log] [blame]
Philip Zeyliger4de80d22025-04-23 12:33:31 -07001name: Code Formatting
2on:
3 workflow_call:
4 push:
5 branches-ignore:
6 - "queue-main-**"
7 pull_request:
8
9jobs:
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 Zeyliger2032b1c2025-04-23 19:40:42 -070021 cache-dependency-path: webui/package-lock.json
Philip Zeyliger4de80d22025-04-23 12:33:31 -070022
23 - name: Install dependencies
Philip Zeyliger2032b1c2025-04-23 19:40:42 -070024 working-directory: ./webui
Philip Zeyliger4de80d22025-04-23 12:33:31 -070025 run: npm ci
26
27 - name: Check Prettier formatting
Philip Zeyliger2032b1c2025-04-23 19:40:42 -070028 working-directory: ./webui
Philip Zeyliger4de80d22025-04-23 12:33:31 -070029 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"