Skip to content

SDK Update API from Spec #401

SDK Update API from Spec

SDK Update API from Spec #401

name: SDK Update API from Spec
on:
schedule:
- cron: '0 4 * * *'
workflow_dispatch:
jobs:
api-spec-update:
runs-on: ubuntu-latest
if: ${{ github.repository == 'jellyfin/jellyfin-sdk-typescript' }}
steps:
- name: Check out Git repository
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Set up Node.js
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 16
check-latest: true
cache: npm
- name: Download stable OpenAPI schema
run: |
curl -sL https://repo.jellyfin.org/releases/openapi/jellyfin-openapi-stable.json -o openapi.json
npm run fix-schema
cp openapi.json $HOME
- name: Set STABLE_API_VERSION
run: |
VERSION=$(jq -r .info.version openapi.json)
echo "STABLE_API_VERSION=${VERSION}" >> $GITHUB_ENV
- name: Install Node.js dependencies
run: npm ci --no-audit
- name: Update generated sources and create pull request
uses: technote-space/create-pr-action@91114507cf92349bec0a9a501c2edf1635427bc5 # v2
with:
EXECUTE_COMMANDS: |
cp $HOME/openapi.json .
npm run build:generated-client
sed -i "s/API_VERSION = '.*'/API_VERSION = '${{ env.STABLE_API_VERSION }}'/" src/versions.ts
COMMIT_MESSAGE: 'Update generated sources to ${{ env.STABLE_API_VERSION }}'
COMMIT_NAME: 'jellyfin-bot'
COMMIT_EMAIL: '[email protected]'
PR_BRANCH_PREFIX: 'openapi-update-'
PR_BRANCH_NAME: '${PR_ID}'
PR_TITLE: 'Update OpenAPI to ${{ env.STABLE_API_VERSION }}'
PR_BODY: |
## Changed files
<details>
<summary>${FILES_SUMMARY}</summary>
${FILES}
</details>
GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}