Bump the github-action-dependencies group across 1 directory with 8 u… #191
Workflow file for this run
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 Python | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| - "!main" | |
| paths: | |
| - "src/**/*.json" | |
| - ".github/workflows/generate-python.yml" | |
| # Allow only one generate workflow to run at a time. This avoids race conditions when | |
| # pushing to the same branch. | |
| concurrency: "generate" | |
| jobs: | |
| generate-python: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate token | |
| id: generate_token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ secrets.DAPLA_BOT_APP_ID }} | |
| private-key: ${{ secrets.DAPLA_BOT_PRIVATE_KEY }} | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ steps.generate_token.outputs.token }} | |
| - name: Configure Git | |
| run: | | |
| git config user.name "dapla-bot[bot]" | |
| git config user.email "143391972+dapla-bot[bot]@users.noreply.github.com" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.7.2" | |
| enable-cache: true | |
| - name: Generate All-optional Python models | |
| run: > | |
| uv run --no-project --with datamodel-code-generator -- ./bin/generate_python.sh --output=generated/python/datadoc_model/datadoc_model/all_optional/model.py --force-optional | |
| - name: Generate Required Python models | |
| run: > | |
| uv run --no-project --with datamodel-code-generator -- ./bin/generate_python.sh --output=generated/python/datadoc_model/datadoc_model/required/model.py | |
| - name: Check for modified files | |
| id: git-check | |
| run: echo modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi) >> $GITHUB_OUTPUT | |
| - name: Commit | |
| if: steps.git-check.outputs.modified == 'true' | |
| run: | | |
| git add -A | |
| git commit -m '[GENERATE] Pydantic models from JSON Schema' | |
| - name: Push | |
| if: steps.git-check.outputs.modified == 'true' | |
| run: | | |
| git pull --rebase origin "${GITHUB_REF}" | |
| git push origin "${GITHUB_REF}" |