|
| 1 | +name: Update ComfyUI-Manager API Types |
| 2 | + |
| 3 | +on: |
| 4 | + # Manual trigger |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +jobs: |
| 8 | + update-manager-types: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + permissions: |
| 11 | + contents: write |
| 12 | + pull-requests: write |
| 13 | + steps: |
| 14 | + - name: Checkout repository |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Setup Node.js |
| 18 | + uses: actions/setup-node@v4 |
| 19 | + with: |
| 20 | + node-version: lts/* |
| 21 | + cache: 'npm' |
| 22 | + |
| 23 | + - name: Install dependencies |
| 24 | + run: npm ci |
| 25 | + |
| 26 | + - name: Checkout ComfyUI-Manager repository |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + repository: Comfy-Org/ComfyUI-Manager |
| 30 | + path: ComfyUI-Manager |
| 31 | + clean: true |
| 32 | + |
| 33 | + - name: Get Manager commit information |
| 34 | + id: manager-info |
| 35 | + run: | |
| 36 | + cd ComfyUI-Manager |
| 37 | + MANAGER_COMMIT=$(git rev-parse --short HEAD) |
| 38 | + echo "commit=${MANAGER_COMMIT}" >> $GITHUB_OUTPUT |
| 39 | + cd .. |
| 40 | +
|
| 41 | + - name: Generate Manager API types |
| 42 | + run: | |
| 43 | + echo "Generating TypeScript types from ComfyUI-Manager@${{ steps.manager-info.outputs.commit }}..." |
| 44 | + npx openapi-typescript ./ComfyUI-Manager/openapi.yaml --output ./src/types/generatedManagerTypes.ts |
| 45 | +
|
| 46 | + - name: Validate generated types |
| 47 | + run: | |
| 48 | + if [ ! -f ./src/types/generatedManagerTypes.ts ]; then |
| 49 | + echo "Error: Types file was not generated." |
| 50 | + exit 1 |
| 51 | + fi |
| 52 | +
|
| 53 | + # Check if file is not empty |
| 54 | + if [ ! -s ./src/types/generatedManagerTypes.ts ]; then |
| 55 | + echo "Error: Generated types file is empty." |
| 56 | + exit 1 |
| 57 | + fi |
| 58 | +
|
| 59 | + - name: Check for changes |
| 60 | + id: check-changes |
| 61 | + run: | |
| 62 | + if [[ -z $(git status --porcelain ./src/types/generatedManagerTypes.ts) ]]; then |
| 63 | + echo "No changes to ComfyUI-Manager API types detected." |
| 64 | + echo "changed=false" >> $GITHUB_OUTPUT |
| 65 | + exit 0 |
| 66 | + else |
| 67 | + echo "Changes detected in ComfyUI-Manager API types." |
| 68 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 69 | + fi |
| 70 | +
|
| 71 | + - name: Create Pull Request |
| 72 | + if: steps.check-changes.outputs.changed == 'true' |
| 73 | + uses: peter-evans/create-pull-request@v7 |
| 74 | + with: |
| 75 | + token: ${{ secrets.PR_GH_TOKEN }} |
| 76 | + commit-message: '[chore] Update ComfyUI-Manager API types from ComfyUI-Manager@${{ steps.manager-info.outputs.commit }}' |
| 77 | + title: '[chore] Update ComfyUI-Manager API types from ComfyUI-Manager@${{ steps.manager-info.outputs.commit }}' |
| 78 | + body: | |
| 79 | + ## Automated API Type Update |
| 80 | +
|
| 81 | + This PR updates the ComfyUI-Manager API types from the latest ComfyUI-Manager OpenAPI specification. |
| 82 | +
|
| 83 | + - Manager commit: ${{ steps.manager-info.outputs.commit }} |
| 84 | + - Generated on: ${{ github.event.repository.updated_at }} |
| 85 | +
|
| 86 | + These types are automatically generated using openapi-typescript. |
| 87 | + branch: update-manager-types-${{ steps.manager-info.outputs.commit }} |
| 88 | + base: main |
| 89 | + labels: Manager |
| 90 | + delete-branch: true |
| 91 | + add-paths: | |
| 92 | + src/types/generatedManagerTypes.ts |
0 commit comments