Skip to content

Update from Schema Release #523

Update from Schema Release

Update from Schema Release #523

Workflow file for this run

name: Update from Schema Release
on:
schedule:
- cron: "0 */6 * * *"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
packages: read
env:
CODEGEN_IMAGE: ghcr.io/sienna-platform/power-openapi-models/codegen:latest
jobs:
check-and-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get latest schema release
id: schema
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LATEST=$(gh release view --repo Sienna-Platform/SiennaSchemas --json tagName -q .tagName)
CURRENT=$(cat .schema-version 2>/dev/null || echo "none")
echo "latest=$LATEST" >> "$GITHUB_OUTPUT"
echo "current=$CURRENT" >> "$GITHUB_OUTPUT"
echo "changed=$( [ "$LATEST" != "$CURRENT" ] && echo true || echo false )" >> "$GITHUB_OUTPUT"
- name: Download and extract schemas
if: steps.schema.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download ${{ steps.schema.outputs.latest }} \
--repo Sienna-Platform/SiennaSchemas --pattern '*.tar.gz' --dir /tmp
tar -xzf /tmp/schemas-*.tar.gz -C /tmp
- name: Login to GHCR
if: steps.schema.outputs.changed == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Regenerate Python models via codegen container
if: steps.schema.outputs.changed == 'true'
run: |
docker run --rm \
-v /tmp/schemas:/schemas:ro \
-v ${{ github.workspace }}:/output \
$CODEGEN_IMAGE
echo "${{ steps.schema.outputs.latest }}" > .schema-version
- uses: actions/setup-python@v5
if: steps.schema.outputs.changed == 'true'
with:
python-version: "3.12"
- name: Validate
if: steps.schema.outputs.changed == 'true'
run: |
pip install -e ".[dev]"
make validate
- name: Open Pull Request
if: steps.schema.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v6
with:
branch: auto/schema-${{ steps.schema.outputs.latest }}
title: "chore: update to schema ${{ steps.schema.outputs.latest }}"
body: |
Auto-generated from [SiennaSchemas ${{ steps.schema.outputs.latest }}](https://github.com/Sienna-Platform/SiennaSchemas/releases/tag/${{ steps.schema.outputs.latest }}).
**Review checklist:**
- [ ] Generated models look correct
- [ ] Tests pass
commit-message: "chore: regenerate models from schema ${{ steps.schema.outputs.latest }}"