SDK Update API from Spec #864
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Node.js | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version: 20 | |
check-latest: true | |
cache: npm | |
- name: Download stable OpenAPI schema | |
run: | | |
curl -sL https://api.jellyfin.org/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 }} |