generate-enums #4
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-enums | |
| on: | |
| schedule: | |
| - cron: "0 6 * * 1" # Every Monday at 06:00 UTC | |
| workflow_dispatch: | |
| jobs: | |
| generate: | |
| name: Fetch server data and regenerate enums + docs | |
| runs-on: ubuntu-latest | |
| environment: overkiz-api | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| # PAT with workflows scope so the push can touch .github/workflows/* | |
| # and so the opened PR triggers CI (GITHUB_TOKEN cannot do either). | |
| token: ${{ secrets.GENERATE_ENUMS_TOKEN }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Install the project | |
| run: uv sync --all-extras --dev | |
| - name: Fetch server data (Somfy Europe) | |
| env: | |
| PYTHONUNBUFFERED: "1" | |
| OVERKIZ_USERNAME: ${{ secrets.OVERKIZ_USERNAME }} | |
| OVERKIZ_PASSWORD: ${{ secrets.OVERKIZ_PASSWORD }} | |
| run: uv run python utils/fetch_server_data.py --server somfy_europe | |
| - name: Generate enums | |
| run: uv run python utils/generate_enums.py | |
| - name: Generate device catalog docs | |
| run: uv run python utils/generate_device_catalog.py | |
| - name: Format generated files | |
| # Auto-fix formatting (ruff, trailing whitespace, end-of-file) on the | |
| # generated outputs so the opened PR passes the lint workflow. Type | |
| # checks and the branch guard are skipped — this is a formatting pass, | |
| # not a gate. prek exits non-zero when it modifies files, which is the | |
| # expected outcome here, so the result is committed by the next step. | |
| env: | |
| SKIP: no-commit-to-branch,mypy,ty | |
| run: | | |
| uv run prek run --files \ | |
| docs/data/*.json \ | |
| pyoverkiz/enums/*.py \ | |
| docs/ui-profiles.md \ | |
| docs/device-types.md \ | |
| || true | |
| - name: Create pull request | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| token: ${{ secrets.GENERATE_ENUMS_TOKEN }} | |
| commit-message: "Update generated enums and docs from Overkiz API" | |
| title: "Update generated enums and docs from Overkiz API" | |
| body: | | |
| Automated weekly regeneration of enum files and documentation from the Overkiz API. | |
| Updated files: | |
| - `docs/data/somfy_europe.json` | |
| - `pyoverkiz/enums/protocol.py` | |
| - `pyoverkiz/enums/ui.py` | |
| - `pyoverkiz/enums/ui_profile.py` | |
| - `pyoverkiz/enums/command.py` | |
| - `docs/ui-profiles.md` | |
| - `docs/device-types.md` | |
| branch: automated/generate-enums | |
| base: main | |
| delete-branch: true |