Skip to content

Commit d48202b

Browse files
authored
ci: use a TODO placeholder title for model-regeneration PRs (#901)
The auto-opened model-regeneration PR used to default its title to `[TODO]: update generated models from apify-docs PR #N`. That looked finished enough to merge as-is and tied the title to apify-docs, even though the right title depends on the actual model diff (a routine `chore:` sync, or a `refactor:`/`feat:`/`fix:` when models meaningfully change). The PR title is now a bare `TODO` placeholder. It carries no valid Conventional Commits type, so `pr-title-check` stays red until a human replaces it. The apify-docs reference and link, plus a `> [!IMPORTANT]` note asking the assignee to replace both the title and the description, now live in the PR body. The automated regeneration commit keeps its own descriptive `chore:` message (separate from the PR title).
1 parent 8a18648 commit d48202b

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

.github/workflows/manual_regenerate_models.yaml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ jobs:
3838
env:
3939
DOCS_PR_NUMBER: ${{ inputs.docs_pr_number }}
4040
BRANCH: ${{ inputs.docs_pr_number && format('update-models-docs-pr-{0}', inputs.docs_pr_number) || 'update-models-manual' }}
41-
TITLE: "${{ inputs.docs_pr_number && format('[TODO]: update generated models from apify-docs PR #{0}', inputs.docs_pr_number) || '[TODO]: update generated models from published OpenAPI spec' }}"
41+
# Message for the automated regeneration commit. Kept descriptive (and traceable to the docs PR) for the
42+
# branch history. It is deliberately NOT reused as the PR title.
43+
COMMIT_MESSAGE: "${{ inputs.docs_pr_number && format('update generated models from apify-docs PR #{0}', inputs.docs_pr_number) || 'update generated models from published OpenAPI spec' }}"
44+
# Placeholder PR title — just `TODO`, so it carries no valid commit type and `pr-title-check` stays red
45+
# until a human replaces it (the default can never be merged as-is). The required action, the apify-docs
46+
# reference, and its link all live in the PR body, not the title.
47+
PR_TITLE: 'TODO'
4248
ASSIGNEE: ${{ inputs.docs_pr_author || github.actor }}
4349
REVIEWER: vdusek
4450
LABEL: t-tooling
@@ -160,7 +166,7 @@ jobs:
160166
if: steps.changes.outputs.has_changes == 'true'
161167
uses: apify/actions/signed-commit@v1.3.0
162168
with:
163-
message: ${{ env.TITLE }}
169+
message: ${{ env.COMMIT_MESSAGE }}
164170
add: "src/apify_client/_models.py src/apify_client/_typeddicts.py src/apify_client/_literals.py"
165171
github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
166172
branch: ${{ env.BRANCH }}
@@ -181,15 +187,18 @@ jobs:
181187
echo "pr_url=$EXISTING_PR" >> "$GITHUB_OUTPUT"
182188
echo "created=false" >> "$GITHUB_OUTPUT"
183189
else
190+
# The PR opens with a `TODO` placeholder title that fails `pr-title-check`. Spell out the required
191+
# action: the assignee must replace both the PR title and this description before merging.
192+
ACTION_NOTE=$'> [!IMPORTANT]\n> **Replace this PR title and description before merging.**\n> - Title: a Conventional Commits message describing the actual model changes (e.g. `chore: ...` for a routine sync, or `refactor:`/`feat:`/`fix:` when models meaningfully change).\n> - Description: summarize what changed in the models.\n\n'
184193
if [[ -n "$DOCS_PR_NUMBER" ]]; then
185194
DOCS_PR_URL="https://github.com/apify/apify-docs/pull/${DOCS_PR_NUMBER}"
186-
BODY="This PR updates the auto-generated Pydantic models and TypedDicts based on OpenAPI specification changes in [apify-docs PR #${DOCS_PR_NUMBER}](${DOCS_PR_URL})."
195+
BODY="${ACTION_NOTE}- Updates the auto-generated Pydantic models and TypedDicts based on the proposed OpenAPI specification changes."$'\n'"- Based on apify-docs PR [#${DOCS_PR_NUMBER}](${DOCS_PR_URL})."
187196
else
188-
BODY="This PR updates the auto-generated Pydantic models and TypedDicts from the [published OpenAPI specification](https://docs.apify.com/api/openapi.json)."
197+
BODY="${ACTION_NOTE}- Updates the auto-generated Pydantic models and TypedDicts based on the latest OpenAPI specification changes."$'\n'"- Based on the [published OpenAPI specification](https://docs.apify.com/api/openapi.json)."
189198
fi
190199
191200
PR_URL=$(gh pr create \
192-
--title "$TITLE" \
201+
--title "$PR_TITLE" \
193202
--body "$BODY" \
194203
--head "$BRANCH" \
195204
--base master \

.rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Each input-side TypedDict ships in two casings: snake_case (`RequestDict`) and c
8282
- To regenerate locally:
8383
- From the live published spec: `uv run poe generate-models`
8484
- From a local spec file: `uv run poe generate-models-from-file path/to/openapi.json`
85-
- In CI, model regeneration is triggered automatically by the `apify/apify-docs` repo when its OpenAPI spec changes (workflow `manual_regenerate_models.yaml`). It downloads the pre-built `openapi-bundles` artifact from the apify-docs workflow run, opens a PR titled `[TODO]: update generated models from apify-docs PR #N`, assigns it to the docs PR author, and posts a cross-repo comment on the original apify-docs PR
85+
- In CI, model regeneration is triggered automatically by the `apify/apify-docs` repo when its OpenAPI spec changes (workflow `manual_regenerate_models.yaml`). It downloads the pre-built `openapi-bundles` artifact from the apify-docs workflow run, opens a PR with a placeholder title (`TODO: replace with a Conventional Commits title...`) that the assignee must replace based on the actual model diff, assigns it to the docs PR author, and posts a cross-repo comment on the original apify-docs PR. The apify-docs PR reference lives in the PR body, not the title
8686
- Manual regeneration is also possible from the GitHub Actions UI (`Regenerate models` workflow)
8787

8888
## Code Conventions

0 commit comments

Comments
 (0)