This commit is contained in:
2026-02-12 18:00:08 +03:00
parent a19b795f9b
commit 0edbdae558
5 changed files with 582 additions and 2 deletions

View File

@@ -170,7 +170,20 @@ reverse_sync() {
log "INFO" "New human commits to sync:"
echo "$human_commits" >&2
# 4. Push through josh to a staging branch
# 4. Merge subrepo changes onto the latest josh-filtered monorepo view
# This ensures the staging branch is based on the latest monorepo main,
# not on the common ancestor between subrepo and monorepo histories.
local subrepo_head
subrepo_head=$(git rev-parse HEAD)
git checkout -B sync-push "mono-filtered/${mono_branch}" >&2
git merge --no-ff "$subrepo_head" \
-m "Sync from subrepo $(date -u +%Y-%m-%dT%H:%M:%SZ)
${BOT_TRAILER}: reverse/${subrepo_branch}/$(date -u +%Y-%m-%dT%H:%M:%SZ)" >&2 \
|| die "Merge conflict during reverse sync — manual intervention needed"
# 5. Push merged branch through josh to a staging branch
local ts
ts=$(date +%Y%m%d-%H%M%S)
local staging_branch="auto-sync/subrepo-${subrepo_branch}-${ts}"
@@ -178,7 +191,7 @@ reverse_sync() {
if git push -o "base=${mono_branch}" "$(josh_auth_url)" "HEAD:refs/heads/${staging_branch}"; then
log "INFO" "Pushed to staging branch via josh: ${staging_branch}"
# 5. Create PR on monorepo (NEVER direct push)
# 6. Create PR on monorepo (NEVER direct push)
local pr_body
pr_body="## Subrepo changes\n\nNew commits from subrepo \`${subrepo_branch}\`:\n\n\`\`\`\n${human_commits}\n\`\`\`\n\n**Review checklist:**\n- [ ] Changes scoped to synced subfolder\n- [ ] No leaked credentials or environment-specific config\n- [ ] CI passes"