Skip to content

Commit f5ed650

Browse files
vdusekclaude
andcommitted
ci: use poe tasks for model generation in CI workflow
Add `generate-models-from-file` poe task that accepts a local file path, working around datamodel-codegen's behavior where `url` in pyproject.toml takes precedence over the `--input` CLI flag. Update the CI workflow to call poe tasks instead of datamodel-codegen directly, ensuring the downloaded artifact is actually used when available. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ad53091 commit f5ed650

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

.github/workflows/manual_regenerate_models.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ jobs:
7979
- name: Generate models from OpenAPI spec
8080
run: |
8181
if [[ -f openapi-spec/openapi.json ]]; then
82-
uv run datamodel-codegen --input openapi-spec/openapi.json
82+
uv run poe generate-models-from-file openapi-spec/openapi.json
8383
else
84-
uv run datamodel-codegen
84+
uv run poe generate-models
8585
fi
8686
8787
- name: Commit model changes

pyproject.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,4 +269,16 @@ shell = "./build_api_reference.sh && corepack enable && yarn && uv run yarn star
269269
cwd = "website"
270270

271271
[tool.poe.tasks.generate-models]
272-
shell = "uv run datamodel-codegen"
272+
shell = "uv run datamodel-codegen && python scripts/fix_generated_models.py"
273+
274+
[tool.poe.tasks.generate-models-from-file]
275+
# The --input flag is ignored when url is set in pyproject.toml, so we temporarily
276+
# replace url with input, run the generator, and restore the original pyproject.toml.
277+
shell = """
278+
sed -i 's|^url = .*|input = "'"$input_file"'"|' pyproject.toml
279+
uv run datamodel-codegen && python scripts/fix_generated_models.py
280+
STATUS=$?
281+
git checkout pyproject.toml
282+
exit $STATUS
283+
"""
284+
args = [{ name = "input-file", positional = true, required = true }]

0 commit comments

Comments
 (0)