Skip to content

Commit af653b4

Browse files
committed
Add github action to check for proto changes
Signed-off-by: Tiago Scolari <tiago@diagrid.io>
1 parent 9440b1f commit af653b4

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

.github/workflows/test-on-push.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ jobs:
4444
run: make modtidy check-diff
4545
- name: Run go mod tidy
4646
run: make modtidy
47+
48+
- name: Install Buf CLI
49+
uses: bufbuild/buf-setup-action@v1.50.0
50+
51+
- name: Run make proto check diff
52+
run: make proto-check-diff

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,21 @@ modtidy:
6464

6565
.PHONY: proto
6666
proto:
67-
rm -rf ./internal/proto/*
68-
buf generate \
67+
@rm -rf ./internal/proto/*
68+
@buf generate \
6969
--template buf.gen.yaml \
7070
--path dapr/proto/common/v1 \
7171
--path dapr/proto/runtime/v1 \
7272
'https://github.com/dapr/dapr.git'
73+
74+
PROTO_PATH := internal/proto
75+
.PHONY: proto-check-diff
76+
proto-check-diff:
77+
@$(MAKE) proto
78+
@# single‐shell if…then…fi block
79+
@if ! git diff --quiet -- $(PROTO_PATH); then \
80+
echo "::error ::Proto files are out of date. Please run 'make proto' and commit the changes."; \
81+
git --no-pager diff -- $(PROTO_PATH); \
82+
exit 1; \
83+
fi
84+

0 commit comments

Comments
 (0)