Skip to content

Commit 02f1016

Browse files
committed
ci: add check to verify OpenAPI spec is up to date
Fails the PR if the committed OpenAPI YAML doesn't match what protoc would generate from the current proto files.
1 parent e78e5e4 commit 02f1016

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/test.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,21 @@ jobs:
2222
- uses: actions/setup-go@v4
2323
with:
2424
go-version: 1.25.x
25-
- run: go test ./...
25+
- run: go test ./...
26+
27+
check-openapi:
28+
name: Check OpenAPI spec is up to date
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: Install protoc-gen-openapi
33+
run: go install github.com/google/gnostic/cmd/protoc-gen-openapi@latest
34+
- name: Regenerate OpenAPI spec
35+
working-directory: protobuff
36+
run: make openapi-v3
37+
- name: Check for differences
38+
run: |
39+
if ! git diff --exit-code protobuff/qubic.openapi.yaml; then
40+
echo "::error::OpenAPI spec is out of date. Run 'make openapi-v3' in protobuff/ and commit the result."
41+
exit 1
42+
fi

0 commit comments

Comments
 (0)