Skip to content

Commit

Permalink
ci: add PR OpenAPI/bindings check action (livepeer#127)
Browse files Browse the repository at this point in the history
* 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.

* ci: improve OpenAPI/bindings change action

This commit improves the code of the OpenAPI and golang bindings check
action.
  • Loading branch information
rickstaa authored and eliteprox committed Jul 26, 2024
1 parent ec3cae1 commit a132970
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/validate-openapi-on-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Check OpenAPI spec and Golang bindings

on:
pull_request:

jobs:
check-openapi-and-bindings:
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
working-directory: runner
run: |
python gen_openapi.py
- name: Check for OpenAPI spec changes
run: |
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

- name: Check for Go bindings changes
run: |
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 a132970

Please sign in to comment.