Skip to content

Commit

Permalink
ci: improve OpenAPI/bindings change action
Browse files Browse the repository at this point in the history
This commit improves the code of the OpenAPI and golang bindings check
action.
  • Loading branch information
rickstaa committed Jul 23, 2024
1 parent 3a64bc5 commit c54f854
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/validate-openapi-on-pr.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Check OpenAPI spec & Golang bindings update
name: Check OpenAPI spec and Golang bindings

on:
pull_request:

jobs:
check-openapi-spec:
check-openapi-and-bindings:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -22,27 +22,23 @@ jobs:
pip install -r runner/requirements.txt
- name: Generate AI OpenAPI specification
working-directory: runner
run: |
cd runner
python gen_openapi.py
cd $GITHUB_WORKSPACE
- name: Check OpenAPI change
- name: Check for OpenAPI spec changes
run: |
git diff --exit-code
if [ $? -ne 0 ]; then
echo "OpenAPI spec has changed. Please run 'python gen_openapi.py' and commit the changes."
if ! git diff --exit-code; then
echo "::error:: OpenAPI spec has changed. Please run 'python gen_openapi.py' in the 'runner' directory and commit the changes."
exit 1
fi
- name: Generate Go bindings
run: |
make
run: make

- name: Check Go bindings change
- name: Check for Go bindings changes
run: |
git diff --exit-code
if [ $? -ne 0 ]; then
echo "Go bindings have changed. Please run 'make' and commit the changes."
if ! git diff --exit-code; then
echo "::error::Go bindings have changed. Please run 'make' at the root of the repository and commit the changes."
exit 1
fi

0 comments on commit c54f854

Please sign in to comment.