Skip to content

ci: prevent regenerate-models from opening duplicate empty PRs#895

Open
vdusek wants to merge 7 commits into
masterfrom
ci/regenerate-models-no-duplicate-prs
Open

ci: prevent regenerate-models from opening duplicate empty PRs#895
vdusek wants to merge 7 commits into
masterfrom
ci/regenerate-models-no-duplicate-prs

Conversation

@vdusek

@vdusek vdusek commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

The Regenerate models workflow opened a new (and mostly empty) PR on every dispatch from a single apify-docs PR. For example, docs PR #2689 produced 7 client PRs (#888 to #894).

Root cause: the "Point branch at current master" step force-pushed the shared update-models-docs-pr-<N> branch to master before committing. That intermediate "branch == master" state made the open PR's head identical to its base, which GitHub auto-closes. The next dispatch's gh pr list --head (open PRs only) then found nothing and created a brand-new PR, leaving the auto-closed one looking empty.

Fix: drop the force-push-to-master step and append the regenerated models to the auto-update branch as signed ("Verified") commits via apify/actions/signed-commit. A fresh docs PR creates the branch and its first commit; each later commit on the docs PR appends another commit, so the client PR mirrors the docs PR and stays open throughout. Repeated dispatches that regenerate identical models add no commit (committed=false), and the docs-PR comment fires only when a PR is created or a commit is appended.

Resetting the shared branch to master before committing on top made the open PR's head identical to its base, which GitHub auto-closes, so every docs-PR dispatch spawned a fresh (and mostly empty) PR. The branch now advances to "master + commit" in one atomic force-push, keeping a single PR open and only updated.
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Jun 24, 2026
@vdusek vdusek self-assigned this Jun 24, 2026
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.52%. Comparing base (cb6602c) to head (aff6e22).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #895   +/-   ##
=======================================
  Coverage   94.52%   94.52%           
=======================================
  Files          48       48           
  Lines        5079     5079           
=======================================
  Hits         4801     4801           
  Misses        278      278           
Flag Coverage Δ
integration 92.89% <ø> (ø)
unit 83.30% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek requested review from Pijukatel and Copilot June 24, 2026 17:08
@vdusek vdusek marked this pull request as ready for review June 24, 2026 17:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Regenerate models GitHub Actions workflow to stop auto-closing (and then recreating) “empty” duplicate PRs by switching from force-resetting the update branch to appending signed commits onto it across repeated dispatches.

Changes:

  • Adds logic to detect whether the auto-update branch already exists and checks it out before regeneration so new changes land as an additional commit.
  • Changes the “did anything change?” check to compare regenerated outputs against the initially-recorded base SHA (rather than the currently checked-out branch HEAD).
  • Adjusts PR creation/commenting logic to reuse an existing PR for the branch and only comment on the docs PR when a PR was created or a commit was appended.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/manual_regenerate_models.yaml Outdated
Comment thread .github/workflows/manual_regenerate_models.yaml Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/manual_regenerate_models.yaml
Comment thread .github/workflows/manual_regenerate_models.yaml Outdated
Comment thread .github/workflows/manual_regenerate_models.yaml Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/manual_regenerate_models.yaml

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants