Skip to content

Commit 7449861

Browse files
committed
fix: repair regenerate-models workflow stale add glob and branch clash
The `add:` pathspec `_*_generated.py` stopped matching anything after the generated files were renamed (PR #765 dropped the `_generated` suffix), so the workflow has been silently producing no commits since 2026-04-29. After PR #792 swapped to `apify/actions/signed-commit`, the pre-existing local `git switch -c "$BRANCH"` step also clashed with the action's `create-branch: true` flow (its `git fetch ... $BRANCH:refs/heads/$BRANCH` refuses to overwrite a checked-out branch), leaving dangling empty branches like `update-models-docs-pr-2546` / `-2548`. This fixes the `add:` list to the actual filenames and skips the local branch creation when the remote branch doesn't yet exist, letting signed-commit handle that path; existing branches are still pre-checked-out locally and `create-branch` is set to `false` for that case.
1 parent 85b450b commit 7449861

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

.github/workflows/manual_regenerate_models.yaml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow regenerates Pydantic models and TypedDicts (src/apify_client/_{models,typeddicts}_generated.py) from the OpenAPI spec.
1+
# This workflow regenerates Pydantic models, TypedDicts, and Literal aliases (src/apify_client/_{models,typeddicts,literals}.py) from the OpenAPI spec.
22
#
33
# It can be triggered in two ways:
44
# 1. Automatically via workflow_dispatch from the apify-docs CI pipeline.
@@ -63,15 +63,20 @@ jobs:
6363
with:
6464
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
6565

66-
# If the branch already exists on the remote (e.g. from a previous run, possibly with reviewer commits),
67-
# check it out to build on top of it instead of starting fresh.
68-
- name: Switch to existing branch or create a new one
66+
# If the branch already exists on the remote (e.g. from a previous run, possibly with reviewer
67+
# commits), check it out so regeneration builds on top of it. Otherwise stay on the default
68+
# branch and let the signed-commit step below create the remote branch — its create-branch
69+
# flow does `git fetch ... $BRANCH:refs/heads/$BRANCH` which fails if $BRANCH is already
70+
# checked out locally.
71+
- name: Set up branch
72+
id: branch-setup
6973
run: |
7074
if git ls-remote --exit-code --heads origin "$BRANCH" > /dev/null 2>&1; then
71-
git fetch origin "$BRANCH"
75+
git fetch origin "$BRANCH":"$BRANCH"
7276
git switch "$BRANCH"
77+
echo "create_branch=false" >> "$GITHUB_OUTPUT"
7378
else
74-
git switch -c "$BRANCH"
79+
echo "create_branch=true" >> "$GITHUB_OUTPUT"
7580
fi
7681
7782
# Download the pre-built OpenAPI spec artifact from the apify-docs workflow run.
@@ -109,10 +114,10 @@ jobs:
109114
uses: apify/actions/signed-commit@v1.0.0
110115
with:
111116
message: ${{ env.TITLE }}
112-
add: 'src/apify_client/_*_generated.py'
117+
add: 'src/apify_client/_models.py src/apify_client/_typeddicts.py src/apify_client/_literals.py'
113118
github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
114119
branch: ${{ env.BRANCH }}
115-
create-branch: 'true'
120+
create-branch: ${{ steps.branch-setup.outputs.create_branch }}
116121

117122
- name: Create or update PR
118123
if: steps.commit.outputs.committed == 'true'

0 commit comments

Comments
 (0)