Update Models #6
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: Update Models | |
| on: | |
| schedule: | |
| - cron: "0 10 * * 5" # Runs "at 10 UTC every Friday" (see https://crontab.guru) | |
| workflow_dispatch: # Runs on manual trigger | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install dependencies | |
| run: |- | |
| python -m pip install --upgrade pip | |
| pip install datamodel-code-generator==0.31.2 | |
| - name: Free space | |
| run: df -h && rm -rf /opt/hostedtoolcache* && df -h | |
| - name: Update models | |
| run: |- | |
| curl -O https://raw.githubusercontent.com/QuantConnect/Documentation/refs/heads/MCP-test/QuantConnect-Platform-2.0.0.yaml | |
| datamodel-codegen --url QuantConnect-Platform-2.0.0.yaml --input-file-type openapi --output src/models.py --remove-special-field-name-prefix --use-annotated --collapse-root-models --use-default-kwarg | |
| python post_processing.py | |
| - name: Push to Branch | |
| run: |- | |
| if [[ $(git diff | wc -m) == 0 ]]; then | |
| exit 0 | |
| fi | |
| BRANCH=github-action-seo-image-creator | |
| git config user.name GitHub Actions | |
| git config user.email github-actions@github.com | |
| git checkout -b $BRANCH | |
| git add . | |
| git commit -m "Code generated by update_models.py" | |
| git push --set-upstream origin $BRANCH -f |