Generate Pydantic Stubs from api.comfy.org #2
This file contains hidden or 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: Generate Pydantic Stubs from api.comfy.org | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 1' | |
| workflow_dispatch: | |
| 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://api.comfy.org/openapi --output comfy_api_nodes/apis --output-model-type pydantic_v2.BaseModel | |
| - name: Check for changes | |
| id: git-check | |
| run: | | |
| git diff --exit-code comfy_api_nodes/apis || 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 api.comfy.org' | |
| body: | | |
| This PR updates the API models based on the latest api.comfy.org OpenAPI specification. | |
| Generated automatically by the a Github workflow. | |
| branch: update-api-stubs | |
| delete-branch: true | |
| base: main |