Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions .github/workflows/manual_regenerate_models.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow regenerates Pydantic models (src/apify_client/_models.py) from the OpenAPI spec.
#
# It can be triggered in two ways:
# 1. Automatically via workflow_dispatch from the apify-docs CI pipeline (with docs_pr_number and docs_workflow_run_id).
# 1. Automatically via workflow_dispatch from the apify-docs CI pipeline.
# 2. Manually from the GitHub UI (without any inputs) to regenerate from the live published spec.

name: Regenerate models
Expand Down Expand Up @@ -63,8 +63,8 @@ jobs:
with:
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}

# If the branch already exists on the remote (e.g. from a previous run, possibly with
# reviewer commits), check it out to build on top of it instead of starting fresh.
# If the branch already exists on the remote (e.g. from a previous run, possibly with reviewer commits),
# check it out to build on top of it instead of starting fresh.
- name: Switch to existing branch or create a new one
run: |
if git ls-remote --exit-code --heads origin "$BRANCH" > /dev/null 2>&1; then
Expand Down Expand Up @@ -155,15 +155,30 @@ jobs:
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
PR_CREATED: ${{ steps.pr.outputs.created }}
PR_URL: ${{ steps.pr.outputs.pr_url }}
DOCS_PR_AUTHOR: ${{ inputs.docs_pr_author }}
run: |
if [[ "$PR_CREATED" = "true" ]]; then
COMMENT="A PR to update the Python client models has been created: ${PR_URL}
MENTION=""
if [[ -n "$DOCS_PR_AUTHOR" ]]; then
MENTION="@${DOCS_PR_AUTHOR} "
fi

This was automatically triggered by OpenAPI specification changes in this PR."
if [[ "$PR_CREATED" = "true" ]]; then
HEADLINE="A companion PR has been opened in \`apify-client-python\` with the regenerated models: ${PR_URL}"
else
COMMENT="The Python client model PR has been updated with the latest OpenAPI spec changes: ${PR_URL}"
HEADLINE="The companion \`apify-client-python\` PR has been updated with the latest spec changes: ${PR_URL}"
fi

COMMENT=$(printf '%s\n' \
"> [!IMPORTANT]" \
"> **Action required** — ${MENTION}please coordinate this docs PR with the Python API client PR linked below." \
">" \
"> Because this PR modifies the OpenAPI specification, the generated models in \`apify-client-python\` must be regenerated to stay in sync. This has already been done automatically:" \
">" \
"> ${HEADLINE}" \
">" \
"> - Please make sure to review and merge both PRs together to keep the OpenAPI spec and API clients in sync." \
"> - You can ask for review and help from the Tooling team if needed.")

gh pr comment "$DOCS_PR_NUMBER" \
--repo apify/apify-docs \
--body "$COMMENT"
Expand Down
Loading