Skip to content

Commit 4375ade

Browse files
committed
ci(model-server): lint the OpenAPI spec for breaking changes
Adds a non-failing workflow to detect breaking changes in the OpenAPI specifications. oasdiff was chosen because: * it provides a GitHub Action * it's more active than other tools
1 parent 549f2ec commit 4375ade

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

.github/workflows/linting.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,29 @@ jobs:
1010
- uses: actions/checkout@v4
1111
- uses: actions/setup-python@v5
1212
- uses: pre-commit/[email protected]
13+
14+
openapi-breaking-changes:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
pull-requests: write
18+
steps:
19+
- name: Clone repo
20+
uses: actions/checkout@v4
21+
with:
22+
# We need the history to find the common ancestor of the PR and the target branch from which we fetch the
23+
# baseline OpenAPI specifications to compare against.
24+
fetch-depth: 0
25+
- name: Fetch baseline OpenAPI specifications
26+
run: |
27+
mergeBase="$(git merge-base --fork-point "origin/${{ github.base_ref }}")"
28+
echo "mergeBase: $mergeBase"
29+
git restore -s "$mergeBase" -W -- model-server-openapi/specifications
30+
cp -R model-server-openapi/specifications model-server-openapi/specifications-before
31+
git checkout model-server-openapi/specifications
32+
- name: Run oasdiff
33+
id: breaking
34+
uses: oasdiff/oasdiff-action/breaking@main
35+
with:
36+
base: 'model-server-openapi/specifications-before/*.yaml'
37+
revision: 'model-server-openapi/specifications/*.yaml'
38+
composed: true

0 commit comments

Comments
 (0)