Skip to content

Commit 30d9596

Browse files
committed
use artifacts
1 parent 706eb4d commit 30d9596

File tree

1 file changed

+13
-31
lines changed

1 file changed

+13
-31
lines changed

.github/workflows/regenerate_models.yaml

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ on:
1010
description: PR number in apify/apify-docs that triggered this workflow
1111
required: true
1212
type: string
13-
docs_pr_sha:
14-
description: Commit SHA from the apify/apify-docs PR
13+
docs_workflow_run_id:
14+
description: Workflow run ID in apify/apify-docs that built the OpenAPI spec artifact
1515
required: true
1616
type: string
1717

@@ -31,7 +31,6 @@ jobs:
3131
env:
3232
GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
3333
DOCS_PR_NUMBER: ${{ inputs.docs_pr_number }}
34-
DOCS_PR_SHA: ${{ inputs.docs_pr_sha }}
3534

3635
steps:
3736
- name: Validate inputs
@@ -40,39 +39,23 @@ jobs:
4039
echo "::error::docs_pr_number must be a positive integer, got: $DOCS_PR_NUMBER"
4140
exit 1
4241
fi
43-
if ! [[ "$DOCS_PR_SHA" =~ ^[a-f0-9]{40}$ ]]; then
44-
echo "::error::docs_pr_sha must be a 40-character hex SHA, got: $DOCS_PR_SHA"
42+
if ! [[ "${{ inputs.docs_workflow_run_id }}" =~ ^[0-9]+$ ]]; then
43+
echo "::error::docs_workflow_run_id must be a numeric run ID, got: ${{ inputs.docs_workflow_run_id }}"
4544
exit 1
4645
fi
4746
4847
- name: Checkout apify-client-python
4948
uses: actions/checkout@v6
5049

51-
- name: Checkout apify-docs at PR commit
52-
uses: actions/checkout@v6
50+
# Download the pre-built OpenAPI spec artifact from the apify-docs workflow run.
51+
- name: Download OpenAPI spec artifact
52+
uses: actions/download-artifact@v4
5353
with:
54+
name: openapi-bundles
55+
path: openapi-spec
5456
repository: apify/apify-docs
55-
ref: ${{ inputs.docs_pr_sha }}
56-
path: apify-docs
57-
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
58-
59-
- name: Set up Node.js
60-
uses: actions/setup-node@v6
61-
with:
62-
node-version: 24
63-
cache: npm
64-
cache-dependency-path: apify-docs/package-lock.json
65-
66-
# Build the bundled OpenAPI JSON from the docs repo sources. This requires Node.js because the spec
67-
# is assembled by the docs build tooling.
68-
- name: Build OpenAPI spec bundle
69-
run: |
70-
cd apify-docs
71-
corepack enable
72-
npm ci --force
73-
npm run openapi:build:json
74-
env:
75-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
57+
run-id: ${{ inputs.docs_workflow_run_id }}
58+
github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
7659

7760
- name: Set up uv
7861
uses: astral-sh/setup-uv@v7
@@ -82,9 +65,8 @@ jobs:
8265
- name: Install dependencies
8366
run: uv run poe install-dev
8467

85-
# We call datamodel-codegen with --input pointing at the locally built spec.
86-
- name: Generate models from local spec
87-
run: uv run datamodel-codegen --input apify-docs/static/api/openapi.json
68+
- name: Generate models from OpenAPI spec
69+
run: uv run datamodel-codegen --input openapi-spec/openapi.json
8870

8971
- name: Check for changes
9072
id: changes

0 commit comments

Comments
 (0)