Skip to content

Keep the commits added to the regeneration pull request - #2

Merged
mrcrgl merged 2 commits into
mainfrom
keep-added-commits
Nov 1, 2026
Merged

mrcrgl merged 2 commits into
mainfrom
keep-added-commits

Conversation

@mrcrgl

@mrcrgl mrcrgl commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

The regeneration pull request asks for a new service's package, or a generator extension, to be added on its branch. The next daily run then threw that work away: it rebuilt the branch from main and force-pushed it. When the API had nothing new, it closed the pull request and deleted the branch.

Now:

  • Added commits are found. That means commits on the open pull request's branch that the workflow didn't author or commit, so an amend or rebase counts too. When there are any, a run checks that branch out, merges main into it and generates on top.
  • Merge conflicts. Conflicts from that merge in files scripts/update.sh rewrites anyway are resolved automatically. Any other conflict fails the run with a message to merge main by hand.
  • Pushing. It pushes with --force-with-lease against the branch as it found it, so a commit pushed during the run fails the run instead of being lost.
  • Closing. It deletes the branch, which closes the pull request, only when nobody has added commits, and only as it found the branch. A branch pushed to during the run stays.
  • Unreadable origin. If origin's branches can't be read, the run fails instead of treating the branch as absent.
  • Forks. A fork's pull request from a branch named regenerate is no longer taken for the workflow's.

Tested:

  • shellcheck on both scripts.
  • A local simulation of both steps against a bare repository, covering six cases:
    • a commit added by someone else, with main conflicting in generated files;
    • an amended workflow commit;
    • nothing new;
    • a push during the run;
    • a conflict outside generated files;
    • an unreadable origin.
  • A dispatch of the first version of this workflow against the open regeneration pull request. It kept the branch and reported it current.

A later run rebuilt the branch from main and force-pushed it, dropping a new service's package added on the branch as the pull request asks, and closed the pull request, deleting the branch, when the API had nothing new. It now generates on top of added commits with main merged in, never closes a pull request that has them, and pushes with a lease, so a commit pushed during the run fails it instead of being lost.
Committers count as well as authors, so an amended commit of the workflow's is kept. An unreadable origin fails the run instead of passing for an absent branch. The branch is deleted only as the run found it, under the lease. Conflicts from merging main resolve in what update.sh writes again; any other fails with a message. A fork's pull request from a branch named regenerate is not taken for the workflow's.
@mrcrgl
mrcrgl merged commit fa9a076 into main Nov 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant