From 3a64bc529229c8ee61c1a0029774b2401929a465 Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Tue, 23 Jul 2024 09:44:19 +0200 Subject: [PATCH] ci: add PR OpenAPI/bindings check action This commit adds a simple action that notifies developers when they forgot to update the OpenAPI spec or golang bindings. --- .github/workflows/validate-openapi-on-pr.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/validate-openapi-on-pr.yaml diff --git a/.github/workflows/validate-openapi-on-pr.yaml b/.github/workflows/validate-openapi-on-pr.yaml new file mode 100644 index 00000000..66695091 --- /dev/null +++ b/.github/workflows/validate-openapi-on-pr.yaml @@ -0,0 +1,48 @@ +name: Check OpenAPI spec & Golang bindings update + +on: + pull_request: + +jobs: + check-openapi-spec: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: "pip" + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install -r runner/requirements.txt + + - name: Generate AI OpenAPI specification + run: | + cd runner + python gen_openapi.py + cd $GITHUB_WORKSPACE + + - name: Check OpenAPI change + run: | + git diff --exit-code + if [ $? -ne 0 ]; then + echo "OpenAPI spec has changed. Please run 'python gen_openapi.py' and commit the changes." + exit 1 + fi + + - name: Generate Go bindings + run: | + make + + - name: Check Go bindings change + run: | + git diff --exit-code + if [ $? -ne 0 ]; then + echo "Go bindings have changed. Please run 'make' and commit the changes." + exit 1 + fi