forked from koala73/worldmonitor
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (54 loc) · 2.05 KB
/
proto-check.yml
File metadata and controls
64 lines (54 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Proto Generation Check
on:
pull_request:
paths:
- 'proto/**'
- 'src/generated/**'
- 'docs/api/**'
- 'Makefile'
- '.github/workflows/proto-check.yml'
permissions:
contents: read
jobs:
proto-freshness:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version: '1.23'
cache: false
- name: Cache Go binaries (buf, protoc plugins)
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
with:
path: ~/go/bin
key: go-bin-${{ runner.os }}-${{ hashFiles('Makefile') }}
- name: Install buf and protoc plugins
run: make install-buf install-plugins
env:
GOPROXY: direct
GOPRIVATE: github.com/SebastienMelki
- name: Run proto generation
run: make generate
- name: Verify generated code is up to date
run: |
if ! git diff --exit-code src/generated/ docs/api/; then
echo ""
echo "============================================================"
echo "ERROR: Proto-generated code is out of date."
echo "Run 'make generate' locally and commit the updated files."
echo "============================================================"
exit 1
fi
UNTRACKED=$(git ls-files --others --exclude-standard src/generated/ docs/api/)
if [ -n "$UNTRACKED" ]; then
echo ""
echo "============================================================"
echo "ERROR: Untracked generated files found:"
echo "$UNTRACKED"
echo "Run 'make generate' locally and commit the new files."
echo "============================================================"
exit 1
fi
echo "Proto-generated code is up to date."