Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 26 additions & 39 deletions .github/workflows/sync-alpha-from-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,16 @@ jobs:
git rebase --abort 2>/dev/null || true

echo "Rebase had conflicts — falling back to merge"
MERGE_MSG=$(cat <<'MSG'
chore: merge main into alpha (conflict resolution required)

Automated merge of origin/main into origin/alpha.
Rebase encountered conflicts; falling back to merge.
A human must resolve conflict markers before merging this PR.
MSG
)
MERGE_MSG="chore: merge main into alpha (conflict resolution required)"
MERGE_MSG="${MERGE_MSG}"$'\n\n'"Automated merge of origin/main into origin/alpha."
MERGE_MSG="${MERGE_MSG}"$'\n'"Rebase encountered conflicts; falling back to merge."
MERGE_MSG="${MERGE_MSG}"$'\n'"A human must resolve conflict markers before merging this PR."
git merge --no-ff --allow-unrelated-histories origin/main -m "${MERGE_MSG}" || {
git add -A
CONFLICT_MSG=$(cat <<'MSG'
chore: best-effort merge main into alpha (conflicts present)

Automated merge of origin/main into origin/alpha.
Both rebase and merge encountered conflicts. Conflict markers
are present and must be resolved before this PR can be merged.
MSG
)
CONFLICT_MSG="chore: best-effort merge main into alpha (conflicts present)"
CONFLICT_MSG="${CONFLICT_MSG}"$'\n\n'"Automated merge of origin/main into origin/alpha."
CONFLICT_MSG="${CONFLICT_MSG}"$'\n'"Both rebase and merge encountered conflicts. Conflict markers"
CONFLICT_MSG="${CONFLICT_MSG}"$'\n'"are present and must be resolved before this PR can be merged."
git commit --no-verify -m "${CONFLICT_MSG}"
}
}
Expand Down Expand Up @@ -144,33 +136,28 @@ MSG
CONFLICT_NOTE="⚠️ **Conflicts detected.** Rebase fell back to merge. Search for \`<<<<<<<\` conflict markers and resolve before merging."
fi

PR_BODY=$(printf '%s\n' \
"## Summary" "" \
"Automated sync of \`main\` into \`alpha\` triggered by push to \`main\`." "" \
"| | |" "|---|---|" \
"| Commits synced | ${COMMIT_COUNT} |" \
"| origin/main | \`${MAIN_SHA:0:8}\` |" \
"| origin/alpha | \`${ALPHA_SHA:0:8}\` |" "" \
"## Status" "" \
"${CONFLICT_NOTE}" "" \
"## Review Instructions" "" \
"1. Check for conflict markers (\`<<<<<<<\`) in changed files." \
"2. Resolve any conflicts and push to this branch." \
"3. Verify the build passes." \
"4. Merge into \`alpha\`." "" \
"---" \
"*Auto-generated by \`.github/workflows/sync-alpha-from-main.yml\`*")

gh pr create \
--base alpha \
--head "${WORK_BRANCH}" \
--title "chore: sync alpha from main ($(date +%Y-%m-%d))" \
--body "## Summary

Automated sync of \`main\` into \`alpha\` triggered by push to \`main\`.

| | |
|---|---|
| Commits synced | ${COMMIT_COUNT} |
| origin/main | \`${MAIN_SHA:0:8}\` |
| origin/alpha | \`${ALPHA_SHA:0:8}\` |

## Status

${CONFLICT_NOTE}

## Review Instructions

1. Check for conflict markers (\`<<<<<<<\`) in changed files.
2. Resolve any conflicts and push to this branch.
3. Verify the build passes.
4. Merge into \`alpha\`.

---
*Auto-generated by \`.github/workflows/sync-alpha-from-main.yml\`*"
--body "${PR_BODY}"

- name: Summary
if: always()
Expand Down
Loading