[PR #8957] [MERGED] fix(ci): replace rebase sync with batched merge PR, add auto-retarget #25225

Closed
opened 2026-04-15 22:46:29 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8957
Author: @gustavovalverde
Created: 4/4/2026
Status: Merged
Merged: 4/4/2026
Merged by: @gustavovalverde

Base: mainHead: fix/forward-sync-batched-merge


📝 Commits (3)

  • 78e1f80 feat(ci)!: replace rebase sync with batched merge PR, add auto-retarget
  • fa14aed fix(ci): address review feedback on forward sync PR
  • 8a8c1f5 fix(ci): add contents:read permission to auto-retarget job

📊 Changes

6 files changed (+121 additions, -38 deletions)

View changed files

📝 .cspell/tech-terms.txt (+2 -0)
.github/workflows/auto-retarget.yml (+74 -0)
📝 .github/workflows/promote.yml (+14 -6)
📝 .github/workflows/release.yml (+26 -30)
📝 .github/workflows/verify-changesets.yml (+2 -2)
📝 .github/zizmor.yml (+3 -0)

📄 Description

Summary

Replace the rebase-based forward sync (main → next) with a batched merge PR approach, and add automatic PR retargeting for minor/major changesets.

Why

The rebase sync rewrites commit timestamps, breaks GPG verification, shows dual authorship, and force-pushes ~100x/month. Testing confirmed GitHub's rebase merge produces verified: false commits (platform limitation, open since 2018).

Research across 15 top npm packages and 5 stateful products (Prisma, Payload, Auth.js, Strapi, Drizzle) shows the industry splits between single-trunk (cherry-pick backports) and two-branch (forward sync) models. better-auth's evolving architecture (refactors several times/month) makes cherry-pick backports impractical — fixes would constantly conflict with refactored APIs. The two-branch model with merge-based sync is the right fit.

Full architectural decision: ADR: Forward Sync and Branch Strategy

Changes

  • release.yml: Replace rebase + force-push with sync PR creation (main → next). Conflict detection with retry polling and has-conflicts label.
  • promote.yml: Change merge instruction from "Rebase and merge" to "Create a merge commit" (admin bypass). Add post-promote re-entry instructions.
  • auto-retarget.yml: New workflow. Reads changeset bump types via GitHub API (no checkout of untrusted content). Retargets minor/major PRs from main to next automatically.
  • verify-changesets.yml: Error messages reference auto-retarget.
  • zizmor.yml: Ignore entry for auto-retarget's pull_request_target.

Summary by cubic

Switch forward sync (main → next) from rebase/force-push to a batched merge PR to preserve commit signatures and avoid force pushes. Add auto-retargeting of PRs with minor/major changesets from main to next, and require a merge commit for promotions.

  • New Features

    • Added auto-retarget.yml to detect changeset bump types via GitHub API and retarget minor/major PRs to next with a label and comment.
    • release.yml now creates a sync PR from main to next and polls mergeable state; adds a has-conflicts label when needed.
  • Refactors

    • promote.yml: require “Create a merge commit” (admin bypass) and add post-promotion re-entry instructions and push error handling.
    • verify-changesets.yml: clearer errors that reference auto-retarget for minor/major bumps on main.
    • zizmor.yml: ignore entry for auto-retarget.yml; comment clarifies API-only content reads (no checkout).
    • Hardening: auto-retarget.yml uses stricter bump parsing, a newline-safe filename loop, and adds contents:read permission; release.yml scopes sync PR search to the repo owner to avoid fork matches.

Written for commit 8a8c1f5eca. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8957 **Author:** [@gustavovalverde](https://github.com/gustavovalverde) **Created:** 4/4/2026 **Status:** ✅ Merged **Merged:** 4/4/2026 **Merged by:** [@gustavovalverde](https://github.com/gustavovalverde) **Base:** `main` ← **Head:** `fix/forward-sync-batched-merge` --- ### 📝 Commits (3) - [`78e1f80`](https://github.com/better-auth/better-auth/commit/78e1f80b6ed99f868b8389877d77af2e9fa0b490) feat(ci)!: replace rebase sync with batched merge PR, add auto-retarget - [`fa14aed`](https://github.com/better-auth/better-auth/commit/fa14aede983dadd21ab90d873c3ed180e68733d6) fix(ci): address review feedback on forward sync PR - [`8a8c1f5`](https://github.com/better-auth/better-auth/commit/8a8c1f5ecab35876992d051a1411026bbb27be33) fix(ci): add contents:read permission to auto-retarget job ### 📊 Changes **6 files changed** (+121 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `.cspell/tech-terms.txt` (+2 -0) ➕ `.github/workflows/auto-retarget.yml` (+74 -0) 📝 `.github/workflows/promote.yml` (+14 -6) 📝 `.github/workflows/release.yml` (+26 -30) 📝 `.github/workflows/verify-changesets.yml` (+2 -2) 📝 `.github/zizmor.yml` (+3 -0) </details> ### 📄 Description ## Summary Replace the rebase-based forward sync (main → next) with a batched merge PR approach, and add automatic PR retargeting for minor/major changesets. ### Why The rebase sync rewrites commit timestamps, breaks GPG verification, shows dual authorship, and force-pushes ~100x/month. Testing confirmed GitHub's rebase merge produces `verified: false` commits (platform limitation, open since 2018). Research across 15 top npm packages and 5 stateful products (Prisma, Payload, Auth.js, Strapi, Drizzle) shows the industry splits between single-trunk (cherry-pick backports) and two-branch (forward sync) models. better-auth's evolving architecture (refactors several times/month) makes cherry-pick backports impractical — fixes would constantly conflict with refactored APIs. The two-branch model with merge-based sync is the right fit. Full architectural decision: [ADR: Forward Sync and Branch Strategy](https://www.notion.so/338e081b657c81d7ba44d901ab557802) ### Changes - **release.yml**: Replace rebase + force-push with sync PR creation (`main → next`). Conflict detection with retry polling and `has-conflicts` label. - **promote.yml**: Change merge instruction from "Rebase and merge" to "Create a merge commit" (admin bypass). Add post-promote re-entry instructions. - **auto-retarget.yml**: New workflow. Reads changeset bump types via GitHub API (no checkout of untrusted content). Retargets minor/major PRs from `main` to `next` automatically. - **verify-changesets.yml**: Error messages reference auto-retarget. - **zizmor.yml**: Ignore entry for auto-retarget's `pull_request_target`. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Switch forward sync (main → next) from rebase/force-push to a batched merge PR to preserve commit signatures and avoid force pushes. Add auto-retargeting of PRs with minor/major changesets from `main` to `next`, and require a merge commit for promotions. - **New Features** - Added `auto-retarget.yml` to detect changeset bump types via GitHub API and retarget minor/major PRs to `next` with a label and comment. - `release.yml` now creates a sync PR from `main` to `next` and polls mergeable state; adds a `has-conflicts` label when needed. - **Refactors** - `promote.yml`: require “Create a merge commit” (admin bypass) and add post-promotion re-entry instructions and push error handling. - `verify-changesets.yml`: clearer errors that reference auto-retarget for minor/major bumps on `main`. - `zizmor.yml`: ignore entry for `auto-retarget.yml`; comment clarifies API-only content reads (no checkout). - Hardening: `auto-retarget.yml` uses stricter bump parsing, a newline-safe filename loop, and adds contents:read permission; `release.yml` scopes sync PR search to the repo owner to avoid fork matches. <sup>Written for commit 8a8c1f5ecab35876992d051a1411026bbb27be33. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 22:46:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#25225