Skip to content

Commit

Permalink
ci(ai): improve AI OpenAPI spec check action (#611)
Browse files Browse the repository at this point in the history
* ci(ai): add AI OpenApi spec update action

This commit adds a new action that can be triggered from the
https://github.com/livepeer/ai-worker repository to update the OpenAPI
AI spec and create a pull request with the new spec.

* chore(ai): update AI OpenAPI spec (#11)

Co-authored-by: rickstaa <[email protected]>

* test: new action

* ci(ai): improve OpenAPI spec update action message

This commit updates the OpenAPI spec update message to reflect whther
the action was triggered by tag or manual trigger.

* ci(ai): improve OpenAPI spec update action message

This commit updates the OpenAPI spec update message to reflect whther
the action was triggered by tag or manual trigger.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: rickstaa <[email protected]>
  • Loading branch information
3 people authored Aug 2, 2024
1 parent dca9e00 commit 5b3978a
Show file tree
Hide file tree
Showing 2 changed files with 839 additions and 6 deletions.
29 changes: 23 additions & 6 deletions .github/workflows/update_ai_api_reference.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,28 @@ jobs:
pip install -r ai-worker/runner/requirements.txt
- name: Generate AI OpenAPI specification
working-directory: ai-worker/runner
run: |
cd ai-worker/runner
python gen_openapi.py --entrypoint gateway
mv openapi_gateway.json $GITHUB_WORKSPACE/ai/api-reference/ai_openapi_schema.json
cd $GITHUB_WORKSPACE
mv openapi_gateway.json $GITHUB_WORKSPACE/ai/api-reference/openapi_ai_gateway.json
- name: Set PR message
id: set-message
run: |
if [ "${{ github.event.client_payload.triggered_by }}" = "manual" ]; then
echo "message=This is an automated pull request to update the AI OpenAPI specification due to changes in the AI Worker OpenAPI specification (upstream commit [${{ github.event.client_payload.sha }}](https://github.com/livepeer/ai-worker/commit/${{ github.event.client_payload.sha }}))." >> $GITHUB_ENV
else
echo "message=This is an automated pull request to update the AI OpenAPI specification due to changes in the AI Worker OpenAPI specification present in release [${{ github.event.client_payload.version }}](https://github.com/livepeer/ai-worker/releases/tag/${{ github.event.client_payload.version }})." >> $GITHUB_ENV
fi
- name: Set PR message
id: set-message
run: |
if [ "${{ github.event.client_payload.triggered_by }}" = "manual" ]; then
echo "message=This is an automated pull request to update the AI OpenAPI specification due to changes in the AI Worker OpenAPI specification (upstream commit [${{ github.event.client_payload.sha }}](https://github.com/livepeer/ai-worker/commit/${{ github.event.client_payload.sha }}))." >> $GITHUB_ENV
else
echo "message=This is an automated pull request to update the AI OpenAPI specification due to changes in the AI Worker OpenAPI specification present in release [${{ github.event.client_payload.version }}](https://github.com/livepeer/ai-worker/releases/tag/${{ github.event.client_payload.version }})." >> $GITHUB_ENV
fi
- name: Commit OpenAPI spec and create pull request
uses: peter-evans/create-pull-request@v6
Expand All @@ -45,9 +62,9 @@ jobs:
commit-message: "chore(ai): update AI OpenAPI spec"
title: "Automated AI OpenAPI specification update"
body: |
This is an automated pull request to update the AI OpenAPI specification due to changes in the AI Worker OpenAPI specification(upstream commit [${{github.event.client_payload.sha}}](https://livepeer/ai-worker/commit/${{github.event.client_payload.sha}})).
${{ env.message }}
> [!IMPORTANT]
> [!IMPORTANT]
> Please ensure to add new API reference pages to the `ai/api-reference` folder for any newly added pipelines.
branch: "update-openapi-spec"
base: "main"
author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
Loading

0 comments on commit 5b3978a

Please sign in to comment.