Skip to content

Commit

Permalink
ci: add TS/JS SDK OpenAPI spec update trigger (#139)
Browse files Browse the repository at this point in the history
This commit addes a trigger to update the OpenAPI spec in https://github.com/livepeer/ai-sdk-js. Furhter it improves the OpenAPI spec upstream sync action to forward more information.
  • Loading branch information
rickstaa committed Jul 31, 2024
1 parent 52d0491 commit 8833c77
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions .github/workflows/trigger-upstream-openapi-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
paths:
- "runner/openapi.json"
tags:
- 'v*'
workflow_dispatch:

jobs:
Expand All @@ -13,6 +15,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set trigger source
id: set-trigger-source
run: echo "triggered_by=${{ github.event_name == 'workflow_dispatch' && 'manual' || 'version' }}" >> $GITHUB_ENV

- name: Trigger experimental SDKs update
uses: peter-evans/repository-dispatch@v3
with:
Expand All @@ -22,25 +28,39 @@ jobs:
client-payload: '{"sha": "${{ github.sha }}"}'

- name: Trigger released JS/TS SDK update
# if: startsWith(github.ref, 'refs/tags/') # Only run on release.
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.SDKS_TRIGGER_PAT }}
repository: livepeer/ai-sdk-js
repository: rickstaa/ai-sdk-js
event-type: update-ai-openapi
client-payload: '{"sha": "${{ github.sha }}"}'
client-payload: >-
{
"sha": "${{ github.sha }}",
"version": "${{ github.ref_name }}",
"triggered_by": "${{ env.triggered_by }}"
}
trigger-docs-openapi-sync:
runs-on: ubuntu-latest
# if: startsWith(github.ref, 'refs/tags/') # Only run on release.
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set trigger source
id: set-trigger-source
run: echo "triggered_by=${{ github.event_name == 'workflow_dispatch' && 'manual' || 'version' }}" >> $GITHUB_ENV

- name: Trigger docs AI OpenAPI spec update
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.DOCS_TRIGGER_PAT }}
repository: rickstaa/docs
event-type: update-ai-openapi
client-payload: '{"sha": "${{ github.sha }}"}'
client-payload: >-
{
"sha": "${{ github.sha }}",
"version": "${{ github.ref_name }}",
"triggered_by": "${{ env.triggered_by }}"
}

0 comments on commit 8833c77

Please sign in to comment.