Skip to content
Open
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
21 changes: 13 additions & 8 deletions .github/workflows/manual_regenerate_models.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow regenerates Pydantic models and TypedDicts (src/apify_client/_{models,typeddicts}_generated.py) from the OpenAPI spec.
# This workflow regenerates Pydantic models, TypedDicts, and Literal aliases (src/apify_client/_{models,typeddicts,literals}.py) from the OpenAPI spec.
#
# It can be triggered in two ways:
# 1. Automatically via workflow_dispatch from the apify-docs CI pipeline.
Expand Down Expand Up @@ -63,15 +63,20 @@ 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.
- name: Switch to existing branch or create a new one
# If the branch already exists on the remote (e.g. from a previous run, possibly with reviewer
# commits), check it out so regeneration builds on top of it. Otherwise stay on the default
# branch and let the signed-commit step below create the remote branch — its create-branch
# flow does `git fetch ... $BRANCH:refs/heads/$BRANCH` which fails if $BRANCH is already
# checked out locally.
- name: Set up branch
id: branch-setup
run: |
if git ls-remote --exit-code --heads origin "$BRANCH" > /dev/null 2>&1; then
git fetch origin "$BRANCH"
git fetch origin "$BRANCH":"$BRANCH"
git switch "$BRANCH"
echo "create_branch=false" >> "$GITHUB_OUTPUT"
else
git switch -c "$BRANCH"
echo "create_branch=true" >> "$GITHUB_OUTPUT"
fi

# Download the pre-built OpenAPI spec artifact from the apify-docs workflow run.
Expand Down Expand Up @@ -109,10 +114,10 @@ jobs:
uses: apify/actions/signed-commit@v1.0.0
with:
message: ${{ env.TITLE }}
add: 'src/apify_client/_*_generated.py'
add: 'src/apify_client/_models.py src/apify_client/_typeddicts.py src/apify_client/_literals.py'
github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
branch: ${{ env.BRANCH }}
create-branch: 'true'
create-branch: ${{ steps.branch-setup.outputs.create_branch }}

- name: Create or update PR
if: steps.commit.outputs.committed == 'true'
Expand Down
Loading