Skip to content

Commit 706eb4d

Browse files
committed
Address feedback
1 parent e5c2d39 commit 706eb4d

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.github/workflows/regenerate_models.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This workflow regenerates Pydantic models (src/apify_client/_models.py) from the OpenAPI spec whenever
2-
# the spec changes in a apify/apify-docs PR. It is triggered via workflow_dispatch from the apify-docs CI pipeline.
2+
# the spec changes in an apify/apify-docs PR. It is triggered via workflow_dispatch from the apify-docs CI pipeline.
33

44
name: Regenerate models from OpenAPI spec
55

@@ -36,7 +36,7 @@ jobs:
3636
steps:
3737
- name: Validate inputs
3838
run: |
39-
if ! [[ "$DOCS_PR_NUMBER" =~ ^[0-9]+$ ]]; then
39+
if ! [[ "$DOCS_PR_NUMBER" =~ ^[1-9][0-9]*$ ]]; then
4040
echo "::error::docs_pr_number must be a positive integer, got: $DOCS_PR_NUMBER"
4141
exit 1
4242
fi
@@ -75,7 +75,12 @@ jobs:
7575
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7676

7777
- name: Set up uv
78-
uses: astral-sh/setup-uv@v6
78+
uses: astral-sh/setup-uv@v7
79+
with:
80+
python-version: "3.14"
81+
82+
- name: Install dependencies
83+
run: uv run poe install-dev
7984

8085
# We call datamodel-codegen with --input pointing at the locally built spec.
8186
- name: Generate models from local spec
@@ -114,7 +119,7 @@ jobs:
114119
115120
EXISTING_PR=$(gh pr list --head "$BRANCH" --json url --jq '.[0].url' 2>/dev/null || true)
116121
117-
if [ -n "$EXISTING_PR" ]; then
122+
if [[ -n "$EXISTING_PR" ]]; then
118123
echo "PR already exists: $EXISTING_PR"
119124
echo "pr_url=$EXISTING_PR" >> "$GITHUB_OUTPUT"
120125
echo "created=false" >> "$GITHUB_OUTPUT"
@@ -149,7 +154,7 @@ jobs:
149154
PR_CREATED: ${{ steps.pr.outputs.created }}
150155
PR_URL: ${{ steps.pr.outputs.pr_url }}
151156
run: |
152-
if [ "$PR_CREATED" = "true" ]; then
157+
if [[ "$PR_CREATED" = "true" ]]; then
153158
COMMENT="A PR to update the Python client models has been created: ${PR_URL}
154159
155160
This was automatically triggered by OpenAPI specification changes in this PR."
@@ -164,6 +169,12 @@ jobs:
164169
- name: Comment on failure
165170
if: failure()
166171
run: |
172+
if [[ -z "$DOCS_PR_NUMBER" ]]; then
173+
echo "DOCS_PR_NUMBER is not set; skipping failure comment on apify/apify-docs PR."
174+
exit 0
175+
fi
176+
167177
gh pr comment "$DOCS_PR_NUMBER" \
168178
--repo apify/apify-docs \
169-
--body "Python client model regeneration failed. [See workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})."
179+
--body "Python client model regeneration failed. [See workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})." \
180+
|| echo "Warning: Failed to post failure comment to apify/apify-docs PR #$DOCS_PR_NUMBER."

0 commit comments

Comments
 (0)