name: Generate API Models on: schedule: # Run weekly on Monday at 00:00 UTC - cron: '0 0 * * 1' workflow_dispatch: # Allow manual triggering jobs: generate-models: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip pip install 'datamodel-code-generator[http]' - name: Generate API models run: | datamodel-codegen --use-subclass-enum --url https://stagingapi.comfy.org/openapi --output comfy_api_nodes/apis/stubs.py - name: Check for changes id: git-check run: | git diff --exit-code comfy_extras/apis/stubs.py || echo "changes=true" >> $GITHUB_OUTPUT - name: Create Pull Request if: steps.git-check.outputs.changes == 'true' uses: peter-evans/create-pull-request@v5 with: commit-message: 'chore: update API models from OpenAPI spec' title: 'Update API models from OpenAPI spec' body: | This PR updates the API models based on the latest OpenAPI specification. Generated automatically by the Generate API Models workflow. branch: update-api-models delete-branch: true base: main