Skip to content

Commit 505e56d

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 0345908 commit 505e56d

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

.github/workflows/manual_regenerate_models.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,11 @@ 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
87-
- name: Post-process generated models
88-
run: python scripts/fix_generated_models.py
89-
9087
- name: Commit model changes
9188
id: commit
9289
uses: EndBug/add-and-commit@v10

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,15 @@ cwd = "website"
271271

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

0 commit comments

Comments
 (0)