Skip to content

Commit d473429

Browse files
committed
add github workflow job to ensure openapi specs are up to date
1 parent db35a67 commit d473429

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

.github/workflows/ci-testing-deploy.yml

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2865,7 +2865,39 @@ jobs:
28652865
TAG_PREFIX: hotfix-staging-github
28662866
run: ./ci/deploy/dockerhub-deploy.bash -n
28672867

2868-
api-server-api-spec-backwards-compatible:
2868+
check-api-specs-updated:
2869+
needs: [changes]
2870+
if: ${{ needs.changes.outputs.anything == 'true' || github.event_name == 'push' }}
2871+
timeout-minutes: 10
2872+
name: Check api-specs are up to date
2873+
runs-on: ubuntu-latest
2874+
steps:
2875+
- name: setup python environment
2876+
uses: actions/setup-python@v5
2877+
with:
2878+
python-version: "3.11"
2879+
- name: install uv
2880+
uses: astral-sh/setup-uv@v4
2881+
with:
2882+
version: "0.4.x"
2883+
enable-cache: false
2884+
cache-dependency-glob: "**/service-library/requirements/ci*.txt"
2885+
- name: checkout source branch
2886+
uses: actions/checkout@v4
2887+
with:
2888+
path: source
2889+
- name: Regenerate specs and check
2890+
run: |
2891+
uv venv .venv && source .venv/bin/activate
2892+
make openapi-specs
2893+
changed_files=$(git diff --name-only)
2894+
if echo ${changed_files} | grep -qE '^(openapi\.json|openapi\.yaml)$'; then
2895+
echo "${changed_files}" && echo "Run make openapi-specs and commit changes"
2896+
exit 1
2897+
fi
2898+
2899+
2900+
api-spec-backwards-compatible:
28692901
needs: [changes]
28702902
if: ${{ needs.changes.outputs.anything == 'true' || github.event_name == 'push' }}
28712903
timeout-minutes: 10
@@ -2892,13 +2924,13 @@ jobs:
28922924
path: target
28932925
repository: ${{ github.event.pull_request.base.repo.full_name }}
28942926
ref: ${{ github.event.pull_request.base.ref }}
2895-
- name: Generate target openapi specs
2927+
- name: Generate source openapi-specs
28962928
run: |
2897-
cd target
2929+
cd source
28982930
uv venv .venv && source .venv/bin/activate
28992931
make openapi-specs
2900-
- name: Generate source openapi-specs and compare
2932+
- name: Generate target openapi specs
29012933
run: |
2902-
cd source
2934+
cd target
29032935
uv venv .venv && source .venv/bin/activate
29042936
make openapi-specs

0 commit comments

Comments
 (0)