-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (32 loc) · 1.17 KB
/
Copy pathcontract-validate.yml
File metadata and controls
37 lines (32 loc) · 1.17 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
name: Contract Validate
# Pins committed OpenAPI contracts. The freshly-exported springdoc spec is
# diffed against the committed `services/knowledge-api/openapi.json`. Regenerate
# locally with `./gradlew :services:knowledge-api:exportOpenApiSpec`.
on:
workflow_call:
concurrency:
group: contract-validate-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
contract-validate:
name: Validate OpenAPI Contract
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.3
- uses: ./.github/actions/setup-java-gradle
with:
java-version: '21'
- name: Export OpenAPI specs
run: >
bash infra/scripts/run-strict-command.sh ./gradlew
:services:knowledge-api:exportOpenApiSpec
- name: Diff exported specs against committed openapi.json files
run: |
set -euo pipefail
if ! git diff --exit-code -- services/knowledge-api/openapi.json; then
echo "::error::Committed openapi.json is stale."
echo "::error::Regenerate locally with: ./gradlew :services:knowledge-api:exportOpenApiSpec"
exit 1
fi